diff options
Diffstat (limited to 'test/system/010-images.bats')
-rw-r--r-- | test/system/010-images.bats | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 543876509..66ef53590 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -45,18 +45,33 @@ size | [0-9]\\\+ } @test "podman images - history output" { - run_podman images --format json - actual=$(echo $output | jq -r '.[0].history | length') - is "$actual" "0" - - run_podman tag $PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG test-image - run_podman images --format json - actual=$(echo $output | jq -r '.[1].history | length') - is "$actual" "0" - actual=$(echo $output | jq -r '.[0].history | length') - is "$actual" "1" - actual=$(echo $output | jq -r '.[0].history[0]') - is "$actual" "$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME:$PODMAN_TEST_IMAGE_TAG" + # podman history is persistent: it permanently alters our base image. + # Create a dummy image here so we leave our setup as we found it. + run_podman run --name my-container $IMAGE true + run_podman commit my-container my-test-image + + run_podman images my-test-image --format '{{ .History }}' + is "$output" "" "Image has empty history to begin with" + + # Generate two randomish tags; 'tr' because they must be all lower-case + rand_name1="test-image-history-$(random_string 10 | tr A-Z a-z)" + rand_name2="test-image-history-$(random_string 10 | tr A-Z a-z)" + + # Tag once, rmi, and make sure the tag name appears in history + run_podman tag my-test-image $rand_name1 + run_podman rmi $rand_name1 + run_podman images my-test-image --format '{{ .History }}' + is "$output" "localhost/${rand_name1}:latest" "image history after one tag" + + # Repeat with second tag. Now both tags should be in history + run_podman tag my-test-image $rand_name2 + run_podman rmi $rand_name2 + run_podman images my-test-image --format '{{ .History }}' + is "$output" "localhost/${rand_name2}:latest, localhost/${rand_name1}:latest" \ + "image history after two tags" + + run_podman rmi my-test-image + run_podman rm my-container } # vim: filetype=sh |