test/system: Simplify building an image without a name

https://github.com/containers/toolbox/pull/1671
This commit is contained in:
Debarshi Ray 2024-06-11 19:23:11 +02:00
parent cc5f8fd432
commit d14d0e52dd
1 changed files with 4 additions and 9 deletions

View File

@ -219,22 +219,17 @@ function _clean_docker_registry() {
function build_image_without_name() {
echo -e "FROM scratch\n\nLABEL com.github.containers.toolbox=\"true\"" > "$BATS_TEST_TMPDIR"/Containerfile
run podman build "$BATS_TEST_TMPDIR"
run podman build --quiet "$BATS_TEST_TMPDIR"
assert_success
assert_line --index 0 --partial "FROM scratch"
assert_line --index 1 --partial "LABEL com.github.containers.toolbox=\"true\""
assert_line --index 2 --partial "COMMIT"
assert_line --index 3 --regexp "^--> [a-f0-9]{6,64}$"
assert_line --index 0 --regexp "^[a-f0-9]{64}$"
# shellcheck disable=SC2154
last=$((${#lines[@]}-1))
assert_line --index "$last" --regexp "^[a-f0-9]{64}$"
assert [ ${#lines[@]} -eq 1 ]
rm -f "$BATS_TEST_TMPDIR"/Containerfile
echo "${lines[$last]}"
echo "${lines[0]}"
}