From 68c06d80f3fb0cdfb3775491dfdd11e1b1abf312 Mon Sep 17 00:00:00 2001 From: Angelica Date: Tue, 24 Sep 2024 15:36:46 -0400 Subject: [PATCH] Created a 'remove part_ file' test --- test/build/40_pull.bats | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/build/40_pull.bats b/test/build/40_pull.bats index 14c034d84..230a40fd2 100644 --- a/test/build/40_pull.bats +++ b/test/build/40_pull.bats @@ -555,3 +555,28 @@ EOF [[ $status -eq 1 ]] [[ $output = *'registry-1.docker.io:443/charliecloud/metadata:doesnotexist'* ]] } + +@test 'remove part_ files' { + export CH_IMAGE_STORAGE=/var/tmp/albug + + # create a part_ file + touch /var/tmp/albug/dlcache/part_PROBLEM + + # list images to invoke error + set +e + out=$(ch-image list 2>&1) + retcode=$? + set -e + + echo "--- return code: ${retcode}" + echo '--- output:' + echo "$out" + + # check if output errors + if [[ $retcode -ne 0 ]]; then + echo "fail: part_ file wasn't cleaned properly." + # Clean up the file if the test fails + rm /var/tmp/albug/dlcache/part_PROBLEM + exit 1 + fi +}