system tests: remove unhelpful assertions
Regular primitive bats uses assertions like '[ $foo = something ]'. These are worthless for debugging: when they fail, all you know is that foo is not "something" but you don't know what foo _is_. Find and replace those assertions with 'assert', which is more informative. Instances found via: $ ack '^ *\[' tests/*.bats There are many matches for 'test' (instead of '[') but those mostly look like file-existence ones, which are less evil than string-check tests. I'm leaving those be for now. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
parent
d1f2cc000c
commit
a75b263f75
|
@ -128,7 +128,7 @@ load helpers
|
|||
run_buildah rmi containers-storage:other-new-image
|
||||
run_buildah rmi another-new-image
|
||||
run_buildah images -q
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "images -q"
|
||||
run_buildah rmi -a
|
||||
run_buildah images -q
|
||||
expect_output ""
|
||||
|
|
|
@ -2064,7 +2064,7 @@ function _test_http() {
|
|||
root=$output
|
||||
test ! -s $root/vol/subvol/subvolfile
|
||||
run stat -c %f $root/vol/subvol
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status code from stat $root/vol/subvol"
|
||||
expect_output "41ed" "stat($root/vol/subvol) [0x41ed = 040755]"
|
||||
}
|
||||
|
||||
|
@ -2180,12 +2180,12 @@ function _test_http() {
|
|||
run_buildah mount ${cid}
|
||||
root=$output
|
||||
run ls $root/data/log
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls $root/data/log"
|
||||
expect_output --substring "test" "ls \$root/data/log"
|
||||
expect_output --substring "blah.txt" "ls \$root/data/log"
|
||||
|
||||
run ls -al $root
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls -al $root"
|
||||
expect_output --substring "test-log -> /data/log" "ls -l \$root/data/log"
|
||||
expect_output --substring "blah -> /test-log" "ls -l \$root/data/log"
|
||||
}
|
||||
|
@ -2199,11 +2199,11 @@ function _test_http() {
|
|||
run_buildah mount ${cid}
|
||||
root=$output
|
||||
run ls $root/log
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls $root/log"
|
||||
expect_output --substring "test" "ls \$root/log"
|
||||
|
||||
run ls -al $root
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls -al $root"
|
||||
expect_output --substring "test-log -> ../log" "ls -l \$root/log"
|
||||
test -r $root/var/data/empty
|
||||
}
|
||||
|
@ -2217,20 +2217,20 @@ function _test_http() {
|
|||
run_buildah mount ${cid}
|
||||
root=$output
|
||||
run ls $root/data/log
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls $root/data/log"
|
||||
expect_output --substring "bin" "ls \$root/data/log"
|
||||
expect_output --substring "blah.txt" "ls \$root/data/log"
|
||||
|
||||
run ls -al $root/myuser
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls -al $root/myuser"
|
||||
expect_output --substring "log -> /test" "ls -al \$root/myuser"
|
||||
|
||||
run ls -al $root/test
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls -al $root/test"
|
||||
expect_output --substring "bar -> /test-log" "ls -al \$root/test"
|
||||
|
||||
run ls -al $root/test-log
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls -al $root/test-log"
|
||||
expect_output --substring "foo -> /data/log" "ls -al \$root/test-log"
|
||||
}
|
||||
|
||||
|
@ -2250,11 +2250,11 @@ function _test_http() {
|
|||
run_buildah mount ${cid}
|
||||
root=$output
|
||||
run ls $root/bin
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls $root/bin"
|
||||
expect_output --substring "myexe" "ls \$root/bin"
|
||||
|
||||
run cat $root/bin/myexe
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from cat $root/bin/myexe"
|
||||
expect_output "symlink-test" "cat \$root/bin/myexe"
|
||||
}
|
||||
|
||||
|
@ -2267,7 +2267,7 @@ function _test_http() {
|
|||
run_buildah mount ${cid}
|
||||
root=$output
|
||||
run ls $root/data
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from ls $root/data"
|
||||
expect_output --substring "myexe" "ls \$root/data"
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ load helpers
|
|||
config="$output"
|
||||
run python3 -c 'import json, sys; config = json.load(sys.stdin); print(config["history"][len(config["history"])-1]["created_by"])' <<< "$config"
|
||||
echo "$output"
|
||||
[ "${status}" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from python command 1"
|
||||
expect_output "untracked actions"
|
||||
|
||||
run_buildah config --created-by "" $cid
|
||||
|
@ -141,7 +141,7 @@ load helpers
|
|||
config="$output"
|
||||
run python3 -c 'import json, sys; config = json.load(sys.stdin); print(config["history"][len(config["history"])-1]["created_by"])' <<< "$config"
|
||||
echo "$output"
|
||||
[ "${status}" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from python command 2"
|
||||
expect_output "/bin/sh"
|
||||
}
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ function check_help() {
|
|||
|
||||
# This can happen if the output of --help changes, such as between
|
||||
# the old command parser and cobra.
|
||||
[ $count -gt 0 ] || \
|
||||
die "Internal error: no commands found in 'buildah help $@' list"
|
||||
assert "$count" -gt 0 \
|
||||
"Internal error: no commands found in 'buildah help $@' list"
|
||||
|
||||
# Sanity check: make sure the special loops above triggered at least once.
|
||||
# (We've had situations where a typo makes the conditional never run in podman)
|
||||
|
@ -85,8 +85,8 @@ function check_help() {
|
|||
|
||||
# This can happen if the output of --help changes, such as between
|
||||
# the old command parser and cobra.
|
||||
[ $count -gt 0 ] || \
|
||||
die "Internal error: no commands found in 'buildah help list"
|
||||
assert "$count" -gt 0 \
|
||||
"Internal error: no commands found in 'buildah help list"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ load helpers
|
|||
|
||||
run_buildah images --json
|
||||
run python3 -m json.tool <<< "$output"
|
||||
[ "${status}" -eq 0 ]
|
||||
assert "$status" -eq 0 "status from python json.tool"
|
||||
}
|
||||
|
||||
@test "specify an existing image" {
|
||||
|
|
|
@ -81,8 +81,10 @@ IMAGE_LIST_S390X_INSTANCE_DIGEST=sha256:882a20ee0df7399a445285361d38b711c299ca09
|
|||
expect_output --substring ${IMAGE_LIST_ARM_INSTANCE_DIGEST}
|
||||
expect_output --substring ${IMAGE_LIST_PPC64LE_INSTANCE_DIGEST}
|
||||
expect_output --substring ${IMAGE_LIST_S390X_INSTANCE_DIGEST}
|
||||
run grep ${IMAGE_LIST_ARM64_INSTANCE_DIGEST} <<< "$output"
|
||||
[ $status -ne 0 ]
|
||||
|
||||
# ARM64 should now be gone
|
||||
arm64=$(grep ${IMAGE_LIST_ARM64_INSTANCE_DIGEST} <<< "$output" || true)
|
||||
assert "$arm64" = "" "arm64 instance digest found in manifest list"
|
||||
}
|
||||
|
||||
@test "manifest-remove-not-found" {
|
||||
|
@ -108,8 +110,9 @@ IMAGE_LIST_S390X_INSTANCE_DIGEST=sha256:882a20ee0df7399a445285361d38b711c299ca09
|
|||
s390x) IMAGE_LIST_EXPECTED_INSTANCE_DIGEST=${IMAGE_LIST_S390X_INSTANCE_DIGEST} ;;
|
||||
*) skip "current arch \"$(go env GOARCH 2> /dev/null)\" not present in manifest list" ;;
|
||||
esac
|
||||
|
||||
run grep ${IMAGE_LIST_EXPECTED_INSTANCE_DIGEST##sha256} ${TEST_SCRATCH_DIR}/pushed/manifest.json
|
||||
[ $status -eq 0 ]
|
||||
assert "$status" -eq 0 "status code of grep for expected instance digest"
|
||||
}
|
||||
|
||||
@test "manifest-push-all" {
|
||||
|
|
|
@ -84,7 +84,7 @@ idmapping_check_map() {
|
|||
local _expect_idmap=$2
|
||||
local _testname=$3
|
||||
|
||||
[ -n "$_output_idmap" ]
|
||||
assert "$_output_idmap" != "" "Internal error: output_idmap is empty"
|
||||
local _idmap=$(sed -E -e 's, +, ,g' -e 's,^ +,,g' <<< "${_output_idmap}")
|
||||
expect_output --from="$_idmap" "${_expect_idmap}" "$_testname"
|
||||
|
||||
|
@ -190,13 +190,13 @@ idmapping_check_permission() {
|
|||
local _output=$1
|
||||
local _testname=$2
|
||||
|
||||
[ "$_output" != "" ]
|
||||
assert "$_output" != "" "Internal error: _output is empty"
|
||||
if [ -z "${uidmapargs[$i]}${gidmapargs[$i]}" ]; then
|
||||
if test "$BUILDAH_ISOLATION" != "chroot" -a "$BUILDAH_ISOLATION" != "rootless" ; then
|
||||
expect_output --from="$_output" "$mynamespace" "/proc/self/ns/user ($_testname)"
|
||||
fi
|
||||
else
|
||||
[ "$_output" != "$mynamespace" ]
|
||||
assert "$_output" != "$mynamespace" "_output vs mynamespace"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ idmapping_check_permission() {
|
|||
run_buildah mount "$ctr"
|
||||
mnt="$output"
|
||||
run stat -c '%u:%g %a' "$mnt"/somedir/someotherfile
|
||||
[ $status -eq 0 ]
|
||||
assert "$status" -eq 0 "status of stat $mnt/somedir/someotherfile"
|
||||
expect_output "$rootuid:$rootgid 4700"
|
||||
|
||||
# Check that a container with mapped-layer can be committed.
|
||||
|
@ -299,15 +299,16 @@ general_namespace() {
|
|||
for namespace in "${types[@]}" ; do
|
||||
# Specify the setting for this namespace for this container.
|
||||
run_buildah from $WITH_POLICY_JSON --quiet --"$nsflag"=$namespace alpine
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "Internal error: buildah-from produced no output"
|
||||
ctr="$output"
|
||||
|
||||
# Check that, unless we override it, we get that setting in "run".
|
||||
run_buildah run $RUNOPTS "$ctr" readlink /proc/self/ns/"$nstype"
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "readlink /proc/self/ns/$nstype must not be empty"
|
||||
case "$namespace" in
|
||||
""|container|private)
|
||||
[ "$output" != "$mynamespace" ]
|
||||
assert "$output" != "$mynamespace" \
|
||||
"readlink /proc/self/ns/$nstype, with namespace=$namespace"
|
||||
;;
|
||||
host)
|
||||
expect_output "$mynamespace"
|
||||
|
@ -321,11 +322,12 @@ general_namespace() {
|
|||
if [ "$nsflag" != "userns" ]; then
|
||||
for different in ${types[@]} ; do
|
||||
# Check that, if we override it, we get what we specify for "run".
|
||||
run_buildah run $RUNOPTS --"$nsflag"=$different "$ctr" readlink /proc/self/ns/"$nstype"
|
||||
[ "$output" != "" ]
|
||||
run_buildah run $RUNOPTS --"$nsflag"=$different "$ctr" readlink /proc/self/ns/"$nstype"
|
||||
assert "$output" != "" "readlink /proc/self/ns/$nstype must not be empty"
|
||||
case "$different" in
|
||||
""|container|private)
|
||||
[ "$output" != "$mynamespace" ]
|
||||
assert "$output" != "$mynamespace" \
|
||||
"readlink /proc/self/ns/$nstype, with different=$different"
|
||||
;;
|
||||
host)
|
||||
expect_output "$mynamespace"
|
||||
|
@ -346,7 +348,7 @@ _EOF
|
|||
result=$(grep -A1 "TargetOutput" <<< "$output" | tail -n1)
|
||||
case "$namespace" in
|
||||
""|container|private)
|
||||
[ "$result" != "$mynamespace" ]
|
||||
assert "$result" != "$mynamespace" "readlink /proc/self/ns/$nstype"
|
||||
;;
|
||||
host)
|
||||
expect_output --from="$result" "$mynamespace"
|
||||
|
@ -422,14 +424,14 @@ _EOF
|
|||
|
||||
echo "buildah from $WITH_POLICY_JSON --ipc=$ipc --net=$net --pid=$pid --userns=$userns --uts=$uts --cgroupns=$cgroupns alpine"
|
||||
run_buildah from $WITH_POLICY_JSON --quiet --ipc=$ipc --net=$net --pid=$pid --userns=$userns --uts=$uts --cgroupns=$cgroupns alpine
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "output from buildah-from"
|
||||
ctr="$output"
|
||||
run_buildah run $ctr pwd
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "output from pwd"
|
||||
run_buildah run --tty=true $ctr pwd
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "output from pwd, with --tty=true"
|
||||
run_buildah run --terminal=false $ctr pwd
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "output from pwd, with --terminal=false"
|
||||
done
|
||||
done
|
||||
done
|
||||
|
@ -500,7 +502,7 @@ utsns = "$mode"
|
|||
EOF
|
||||
|
||||
CONTAINERS_CONF="$containers_conf_file" run_buildah from $WITH_POLICY_JSON --quiet alpine
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "output from buildah-from"
|
||||
ctr="$output"
|
||||
|
||||
local op="=="
|
||||
|
|
|
@ -28,7 +28,7 @@ load helpers
|
|||
|
||||
# This should fail
|
||||
run ls ${TEST_SCRATCH_DIR}/lower/bar
|
||||
[ "$status" -ne 0 ]
|
||||
assert "$status" -ne 0 "status of ls ${TEST_SCRATCH_DIR}/lower/bar"
|
||||
}
|
||||
|
||||
@test "overlay source permissions and owners" {
|
||||
|
@ -58,7 +58,7 @@ load helpers
|
|||
|
||||
# This should fail since /tmp/test was an overlay, not a bind mount
|
||||
run ls ${TEST_SCRATCH_DIR}/lower/bar
|
||||
[ "$status" -ne 0 ]
|
||||
assert "$status" -ne 0 "status of ls ${TEST_SCRATCH_DIR}/lower/bar"
|
||||
}
|
||||
|
||||
@test "overlay path contains colon" {
|
||||
|
@ -92,5 +92,5 @@ load helpers
|
|||
|
||||
# This should fail
|
||||
run ls ${TEST_SCRATCH_DIR}/a:lower/bar
|
||||
[ "$status" -ne 0 ]
|
||||
}
|
||||
assert "$status" -ne 0 "status of ls ${TEST_SCRATCH_DIR}/a:lower/bar"
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ load helpers
|
|||
# force a failed pull and look at the error message which *must* include the
|
||||
# the resolved image name (localhost/image:latest).
|
||||
run_buildah 125 pull --policy=always image
|
||||
[[ "$output" == *"initializing source docker://localhost/image:latest"* ]]
|
||||
assert "$output" =~ "initializing source docker://localhost/image:latest"
|
||||
run_buildah rmi localhost/image ${iid}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ load helpers
|
|||
run_buildah --retry pull --registries-conf ${TEST_SOURCES}/registries.conf $WITH_POLICY_JSON alpine@sha256:e9a2035f9d0d7cee1cdd445f5bfa0c5c646455ee26f14565dce23cf2d2de7570
|
||||
run_buildah 125 pull --registries-conf ${TEST_SOURCES}/registries.conf $WITH_POLICY_JSON fakeimage/fortest
|
||||
run_buildah images --format "{{.Name}}:{{.Tag}}"
|
||||
[[ ! "$output" =~ "fakeimage/fortest" ]]
|
||||
assert "$output" !~ "fakeimage/fortest" "fakeimage/fortest found in buildah images"
|
||||
}
|
||||
|
||||
@test "pull-from-docker-archive" {
|
||||
|
@ -100,7 +100,7 @@ load helpers
|
|||
|
||||
run docker pull alpine
|
||||
echo "$output"
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of docker (yes, docker) pull alpine"
|
||||
run_buildah pull $WITH_POLICY_JSON docker-daemon:docker.io/library/alpine:latest
|
||||
run_buildah images --format "{{.Name}}:{{.Tag}}"
|
||||
expect_output --substring "alpine:latest"
|
||||
|
|
|
@ -31,7 +31,7 @@ load helpers
|
|||
cid3=$output
|
||||
run_buildah 125 rmi alpine busybox
|
||||
run_buildah images -q
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "images -q"
|
||||
|
||||
run_buildah rmi -f alpine busybox
|
||||
run_buildah images -q
|
||||
|
@ -66,7 +66,7 @@ load helpers
|
|||
cid3=$output
|
||||
run_buildah 125 rmi --all
|
||||
run_buildah images -q
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "images -q"
|
||||
|
||||
run_buildah rmi --all --force
|
||||
run_buildah images -q
|
||||
|
|
|
@ -814,7 +814,7 @@ _EOF
|
|||
found_runtime=y
|
||||
run_buildah '?' run --runtime=runc --runtime-flag=debug $cid true
|
||||
if [ "$status" -eq 0 ]; then
|
||||
[ -n "$output" ]
|
||||
assert "$output" != "" "Output from running 'true' with --runtime-flag=debug"
|
||||
else
|
||||
# runc fully supports cgroup v2 (unified mode) since v1.0.0-rc93.
|
||||
# older runc doesn't work on cgroup v2.
|
||||
|
@ -825,7 +825,7 @@ _EOF
|
|||
if [ -n "$(command -v crun)" ]; then
|
||||
found_runtime=y
|
||||
run_buildah run --runtime=crun --runtime-flag=debug $cid true
|
||||
[ -n "$output" ]
|
||||
assert "$output" != "" "Output from running 'true' with --runtime-flag=debug"
|
||||
fi
|
||||
|
||||
if [ -z "${found_runtime}" ]; then
|
||||
|
|
|
@ -16,7 +16,7 @@ load helpers
|
|||
run_buildah from --quiet --quiet $WITH_POLICY_JSON $image
|
||||
cid=$output
|
||||
run_buildah run $cid sh -c 'tr \\0 \\n < /proc/self/attr/current'
|
||||
[ "$output" != "" ]
|
||||
assert "$output" != "" "/proc/self/attr/current cannot be empty"
|
||||
firstlabel="$output"
|
||||
|
||||
# Ensure that we label the same container consistently across multiple "run" instructions.
|
||||
|
|
|
@ -16,7 +16,7 @@ load helpers
|
|||
run jq -r .manifests[0].digest $srcdir/index.json
|
||||
manifestDigest=${output//sha256:/} # strip off the sha256 prefix
|
||||
run stat $srcdir/blobs/sha256/$manifestDigest
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of stat(manifestDigest)"
|
||||
|
||||
# Inspect the manifest
|
||||
run jq -r .schemaVersion $srcdir/blobs/sha256/$manifestDigest
|
||||
|
@ -28,19 +28,20 @@ load helpers
|
|||
run jq -r .mediaType $srcdir/blobs/sha256/$manifestDigest
|
||||
expect_output "application/vnd.oci.image.manifest.v1+json"
|
||||
run jq -r .config.size $srcdir/blobs/sha256/$manifestDigest
|
||||
[ "$status" -eq 0 ] # let's not check the size (afraid of time-stamp impacts)
|
||||
# let's not check the size (afraid of time-stamp impacts)
|
||||
assert "$status" -eq 0 "status of jq .config.size"
|
||||
# Digest of config
|
||||
run jq -r .config.digest $srcdir/blobs/sha256/$manifestDigest
|
||||
configDigest=${output//sha256:/} # strip off the sha256 prefix
|
||||
run stat $srcdir/blobs/sha256/$configDigest
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of stat(configDigest)"
|
||||
|
||||
# Inspect the config
|
||||
run jq -r .created $srcdir/blobs/sha256/$configDigest
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of jq .created on configDigest"
|
||||
creatd=$output
|
||||
run date --date="$output"
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of date (this should never ever fail)"
|
||||
run jq -r .author $srcdir/blobs/sha256/$configDigest
|
||||
expect_output "Buildah authors"
|
||||
|
||||
|
@ -59,7 +60,7 @@ load helpers
|
|||
run jq -r .manifests[0].digest $srcdir/index.json
|
||||
manifestDigestEmpty=${output//sha256:/} # strip off the sha256 prefix
|
||||
run stat $srcdir/blobs/sha256/$manifestDigestEmpty
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of stat(manifestDigestEmpty)"
|
||||
|
||||
# Add layer 1
|
||||
echo 111 > ${TEST_SCRATCH_DIR}/file1
|
||||
|
@ -67,7 +68,8 @@ load helpers
|
|||
# Make sure the digest of the manifest changed
|
||||
run jq -r .manifests[0].digest $srcdir/index.json
|
||||
manifestDigestFile1=${output//sha256:/} # strip off the sha256 prefix
|
||||
[ "$manifestDigestEmpty" != "$manifestDigestFile1" ]
|
||||
assert "$manifestDigestEmpty" != "$manifestDigestFile1" \
|
||||
"manifestDigestEmpty should differ from manifestDigestFile1"
|
||||
|
||||
# Inspect layer 1
|
||||
run jq -r .layers[0].mediaType $srcdir/blobs/sha256/$manifestDigestFile1
|
||||
|
@ -76,7 +78,7 @@ load helpers
|
|||
layer1Digest=${output//sha256:/} # strip off the sha256 prefix
|
||||
# Now make sure the reported size matches the actual one
|
||||
run jq -r .layers[0].size $srcdir/blobs/sha256/$manifestDigestFile1
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of jq .layers[0].size on manifestDigestFile1"
|
||||
layer1Size=$output
|
||||
run du -b $srcdir/blobs/sha256/$layer1Digest
|
||||
expect_output --substring "$layer1Size"
|
||||
|
@ -87,8 +89,10 @@ load helpers
|
|||
# Make sure the digest of the manifest changed
|
||||
run jq -r .manifests[0].digest $srcdir/index.json
|
||||
manifestDigestFile2=${output//sha256:/} # strip off the sha256 prefix
|
||||
[ "$manifestDigestEmpty" != "$manifestDigestFile2" ]
|
||||
[ "$manifestDigestFile1" != "$manifestDigestFile2" ]
|
||||
assert "$manifestDigestEmpty" != "$manifestDigestFile2" \
|
||||
"manifestDigestEmpty should differ from manifestDigestFile2"
|
||||
assert "$manifestDigestFile1" != "$manifestDigestFile2" \
|
||||
"manifestDigestFile1 should differ from manifestDigestFile2"
|
||||
|
||||
# Make sure layer 1 is still in the manifest and remains unchanged
|
||||
run jq -r .layers[0].digest $srcdir/blobs/sha256/$manifestDigestFile2
|
||||
|
@ -103,14 +107,14 @@ load helpers
|
|||
layer2Digest=${output//sha256:/} # strip off the sha256 prefix
|
||||
# Now make sure the reported size matches the actual one
|
||||
run jq -r .layers[1].size $srcdir/blobs/sha256/$manifestDigestFile2
|
||||
[ "$status" -eq 0 ]
|
||||
assert "$status" -eq 0 "status of jq .layers[1].size on manifestDigestFile2"
|
||||
layer2Size=$output
|
||||
run du -b $srcdir/blobs/sha256/$layer2Digest
|
||||
expect_output --substring "$layer2Size"
|
||||
|
||||
# Last but not least, make sure the two layers differ
|
||||
[ "$layer1Digest" != "$layer2Digest" ]
|
||||
[ "$layer1Size" != "$layer2Size" ]
|
||||
assert "$layer1Digest" != "$layer2Digest" "layer1Digest vs layer2Digest"
|
||||
assert "$layer1Size" != "$layer2Size" "layer1Size vs layer2Size"
|
||||
}
|
||||
|
||||
@test "source push/pull" {
|
||||
|
@ -145,7 +149,8 @@ load helpers
|
|||
expect_output --substring "Copying config"
|
||||
|
||||
run diff -r $srcdir $pulldir
|
||||
[ "$status" -eq 0 ]
|
||||
# FIXME: if there's a nonzero chance of this failing, include actual diffs
|
||||
assert "$status" -eq 0 "status from diff of srcdir vs pulldir"
|
||||
|
||||
stop_registry
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue