Skip to content

Commit

Permalink
Change tests to have local testing
Browse files Browse the repository at this point in the history
  • Loading branch information
RishabhSaini committed Apr 17, 2023
1 parent 318d685 commit c8345e8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 15 additions & 15 deletions tests/encapsulate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 29 additions & 0 deletions tests/encapsulate_derived.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c8345e8

Please sign in to comment.