From 7d24e98070122a79e3f9bde39f9a6fb88338149a Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 4 Jul 2023 15:48:37 +0200 Subject: [PATCH] test/system: Silence SC2154 Otherwise https://www.shellcheck.net/ would complain: Line 33: assert [ ${#stderr_lines[@]} -eq 0 ] ^-----------------^ SC2154 (warning): stderr_lines is referenced but not assigned. See: https://www.shellcheck.net/wiki/SC2154 https://github.com/containers/toolbox/pull/1369 --- test/system/001-version.bats | 2 ++ test/system/102-list.bats | 2 ++ test/system/104-run.bats | 2 ++ test/system/107-rmi.bats | 2 ++ test/system/108-completion.bats | 2 ++ test/system/libs/helpers.bash | 4 ++++ 6 files changed, 14 insertions(+) diff --git a/test/system/001-version.bats b/test/system/001-version.bats index daf4e58..0bbd399 100644 --- a/test/system/001-version.bats +++ b/test/system/001-version.bats @@ -30,5 +30,7 @@ setup() { assert_success assert_output --regexp '^toolbox version [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?$' assert [ ${#lines[@]} -eq 1 ] + + # shellcheck disable=SC2154 assert [ ${#stderr_lines[@]} -eq 0 ] } diff --git a/test/system/102-list.bats b/test/system/102-list.bats index 436ad27..7c9adc3 100644 --- a/test/system/102-list.bats +++ b/test/system/102-list.bats @@ -34,6 +34,8 @@ teardown() { assert_success assert [ ${#lines[@]} -eq 0 ] + + # shellcheck disable=SC2154 assert [ ${#stderr_lines[@]} -eq 0 ] } diff --git a/test/system/104-run.bats b/test/system/104-run.bats index e62cf72..9ea9e91 100644 --- a/test/system/104-run.bats +++ b/test/system/104-run.bats @@ -54,6 +54,8 @@ teardown() { assert_success assert [ ${#lines[@]} -eq 0 ] + + # shellcheck disable=SC2154 assert [ ${#stderr_lines[@]} -eq 0 ] } diff --git a/test/system/107-rmi.bats b/test/system/107-rmi.bats index 9022aa5..7d3a8f8 100644 --- a/test/system/107-rmi.bats +++ b/test/system/107-rmi.bats @@ -39,6 +39,8 @@ teardown() { assert_success assert [ ${#lines[@]} -eq 0 ] + + # shellcheck disable=SC2154 assert [ ${#stderr_lines[@]} -eq 0 ] num_of_images="$(list_images)" diff --git a/test/system/108-completion.bats b/test/system/108-completion.bats index bdc59b1..f8d3213 100644 --- a/test/system/108-completion.bats +++ b/test/system/108-completion.bats @@ -29,6 +29,8 @@ setup() { assert_success assert [ ${#lines[@]} -gt 0 ] + + # shellcheck disable=SC2154 assert [ ${#stderr_lines[@]} -eq 0 ] } diff --git a/test/system/libs/helpers.bash b/test/system/libs/helpers.bash index 89761fd..857f485 100644 --- a/test/system/libs/helpers.bash +++ b/test/system/libs/helpers.bash @@ -236,7 +236,10 @@ function build_image_without_name() { 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}$" + + # shellcheck disable=SC2154 last=$((${#lines[@]}-1)) + assert_line --index "$last" --regexp "^[a-f0-9]{64}$" rm -f "$BATS_TEST_TMPDIR"/Containerfile @@ -440,6 +443,7 @@ function container_started() { run "$PODMAN" logs "$container_name" # Look for last line of the container startup log + # shellcheck disable=SC2154 if echo "$output" | grep "Listening to file system and ticker events"; then container_initialized=0 break