diff options
author | Ed Santiago <santiago@redhat.com> | 2022-06-08 13:41:43 -0600 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2022-06-08 19:33:07 -0600 |
commit | bce97a3b5dd1477c74232b49d246491aa289a995 (patch) | |
tree | c1258a578d6126df68210c1e3edb332ef63be22a /test/apiv2/12-imagesMore.at | |
parent | 576c739e5ff01c760b383a258c62ed3ca7e1c30c (diff) | |
download | podman-bce97a3b5dd1477c74232b49d246491aa289a995.tar.gz podman-bce97a3b5dd1477c74232b49d246491aa289a995.tar.bz2 podman-bce97a3b5dd1477c74232b49d246491aa289a995.zip |
apiv2 tests: clean up
Mostly fix a bad design decision I made early on, re: registry.
old: registry starts once, runs to the end
new: registry is brought up on demand, then stopped
Reason: there are times when we need a password-controlled
registry, and times when we need it open.
As long as I'm in here, I've also cleaned up some confusing code
and fixed things so tests can run rootless again.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/apiv2/12-imagesMore.at')
-rw-r--r-- | test/apiv2/12-imagesMore.at | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/test/apiv2/12-imagesMore.at b/test/apiv2/12-imagesMore.at index 98f396a17..57d5e114d 100644 --- a/test/apiv2/12-imagesMore.at +++ b/test/apiv2/12-imagesMore.at @@ -27,20 +27,22 @@ t POST "libpod/images/$IMAGE/tag?repo=localhost:$REGISTRY_PORT/myrepo&tag=mytag" t GET libpod/images/$IMAGE/json 200 \ .RepoTags[1]=localhost:$REGISTRY_PORT/myrepo:mytag -# Push to local registry and check output -while read -r LINE -do - if echo "${LINE}" | jq --exit-status 'select( .status != null) | select ( .status | contains("digest: sha256:"))' &>/dev/null; then - GOT_DIGEST="1" - fi -done < <(curl -sL "http://$HOST:$PORT/images/localhost:$REGISTRY_PORT/myrepo/push?tlsVerify=false&tag=mytag" -XPOST -H "X-Registry-Config: $REGISTRY_CONFIG_HEADER") -if [ -z "${GOT_DIGEST}" ] ; then - echo -e "${red}not ok: did not found digest in output${nc}" 1>&2; -fi - -# Push to local registry +# Push to local registry... t POST "images/localhost:$REGISTRY_PORT/myrepo/push?tlsVerify=false&tag=mytag" 200 +# ...and check output. We can't use our built-in checks because this output +# is a sequence of JSON objects, i.e., individual ones, not in a JSON array. +# The lines themselves are valid JSON, but taken together they are not. +readarray lines <<<"$output" +s0=$(jq -r .status <<<"${lines[0]}") +is "$s0" "The push refers to repository [localhost:$REGISTRY_PORT/myrepo:mytag]" \ + "Push to local registry: first status line" + +# FIXME: is there a way to test the actual digest? +s1=$(jq -r .status <<<"${lines[1]}") +like "$s1" "mytag: digest: sha256:[0-9a-f]\{64\} size: [0-9]\+" \ + "Push to local registry: second status line" + # Untag the image t POST "libpod/images/$iid/untag?repo=localhost:$REGISTRY_PORT/myrepo&tag=mytag" 201 @@ -53,3 +55,5 @@ t GET libpod/images/$IMAGE/json 200 \ # Remove image t DELETE libpod/images/$IMAGE 200 \ .ExitCode=0 + +stop_registry |