From c8345e87780a852559e7dd66ebe5acac0d0964bc Mon Sep 17 00:00:00 2001 From: RishabhSaini Date: Wed, 15 Feb 2023 10:22:35 -0500 Subject: [PATCH] Change tests to have local testing --- Cargo.toml | 2 +- tests/encapsulate.sh | 30 +++++++++++++++--------------- tests/encapsulate_derived.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 16 deletions(-) create mode 100755 tests/encapsulate_derived.sh diff --git a/Cargo.toml b/Cargo.toml index ffe545c620..fe3054a4ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -74,7 +74,7 @@ openssl = "0.10.45" once_cell = "1.16.0" oci-spec = "0.5" os-release = "0.1.0" -ostree-ext = "0.10.0" +ostree-ext = { path = "../ostree-rs-ext/lib"} paste = "1.0" phf = { version = "0.11", features = ["macros"] } rand = "0.8.5" diff --git a/tests/encapsulate.sh b/tests/encapsulate.sh index 19f2ef1621..74b3760692 100755 --- a/tests/encapsulate.sh +++ b/tests/encapsulate.sh @@ -3,24 +3,24 @@ set -xeuo pipefail # Pull the latest FCOS build, unpack its container image, and verify # that we can re-encapsulate it as chunked. -container=quay.io/fedora/fedora-coreos:testing-devel +ver=37.20221111.20.0 +container=quay.io/fedora/fedora-coreos:${ver} -# First, verify the legacy entrypoint still works for now -rpm-ostree container-encapsulate --help >/dev/null - -tmpdir=$(mktemp -d) +tmpdir=/tmp/coreTest-${ver} +mkdir -p ${tmpdir} cd ${tmpdir} -ostree --repo=repo init --mode=bare-user +ostree --repo=repo init cat /etc/ostree/remotes.d/fedora.conf >> repo/config + # Pull and unpack the ostree content, discarding the container wrapping -ostree container unencapsulate --write-ref=testref --repo=repo ostree-remote-registry:fedora:$container -# Re-pack it as a (chunked) container +ostree container unencapsulate --write-ref=testref --repo=repo ostree-unverified-image:containers-storage:${container} -rpm-ostree compose container-encapsulate --repo=repo \ - --label=foo=bar --label baz=blah --copymeta-opt fedora-coreos.stream --copymeta-opt nonexistent.key \ - testref oci:test.oci -skopeo inspect oci:test.oci | jq -r .Labels > labels.json -for label in foo baz 'fedora-coreos.stream'; do - jq -re ".\"${label}\"" < labels.json -done +# Re-pack it as a (chunked) container +start=`date +%s.%N` +/home/redhat/work/dev-updates-remoting/rpm-ostree/rpm-ostree compose container-encapsulate --repo=repo testref oci:${tmpdir}/test.oci +end=`date +%s.%N` +runtime=$( echo "$end - $start" | bc -l ) +skopeo inspect oci:${tmpdir}/test.oci | jq '.LayersData | .[0].Annotations.Content' > annotation_ostree.txt +grep -qFe ostree_commit annotation_ostree.txt +skopeo inspect --config oci:${tmpdir}/test.oci | jq '.rootfs.diff_ids' > layersDiffids.txt echo ok diff --git a/tests/encapsulate_derived.sh b/tests/encapsulate_derived.sh new file mode 100755 index 0000000000..b8a362fcb7 --- /dev/null +++ b/tests/encapsulate_derived.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -xeuo pipefail +# Pull the latest FCOS build, unpack its container image, and verify +# that we can re-encapsulate it as chunked. + +ver=37.20230201.20.0 +packaging_ver=37.20221111.20.0 +compare_ver=37.20230131.20.0 +container=quay.io/fedora/fedora-coreos:${ver} + +tmpdir=/tmp/coreTest-${ver} +p_tmpdir=/tmp/coreTest-${packaging_ver} +mkdir -p ${tmpdir} +cd ${tmpdir} +ostree --repo=repo init +cat /etc/ostree/remotes.d/fedora.conf >> repo/config + +# Pull and unpack the ostree content, discarding the container wrapping +ostree container unencapsulate --write-ref=testref --repo=repo ostree-unverified-image:containers-storage:${container} + +# Re-pack it as a (chunked) container +start=`date +%s.%N` +/home/redhat/work/dev-updates-remoting/rpm-ostree/rpm-ostree compose container-encapsulate --compare-with-build=oci:/tmp/coreTest-${compare_ver}/test.oci --prior-build=oci:/tmp/coreTest-${packaging_ver}/test.oci --repo=repo testref oci:${tmpdir}/test.oci +end=`date +%s.%N` +runtime=$( echo "$end - $start" | bc -l ) +skopeo inspect oci:${tmpdir}/test.oci | jq '.LayersData | .[0].Annotations.Content' > annotation_ostree.txt +grep -qFe ostree_commit annotation_ostree.txt +skopeo inspect --config oci:${tmpdir}/test.oci | jq '.rootfs.diff_ids' > layersDiffids.txt +echo ok