tests/cli-extensions: tweak test logic
authorLuca BRUNO <luca.bruno@coreos.com>
Tue, 21 Dec 2021 10:16:36 +0000 (10:16 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Tue, 21 Dec 2021 10:18:30 +0000 (10:18 +0000)
This updates the test logic for CLI extensions, actually checking
for functional output from the subcommand.
It also cleans up some environmental leftover.

tests/test-cli-extensions.sh

index 6e483c5e14c1a551d545b459f652396d1606c9ae..1fe9c037b447e90a89fcc58efde1b210a634e4ea 100755 (executable)
@@ -10,10 +10,14 @@ set -euo pipefail
 echo '1..2'
 
 mkdir -p ./localbin
+ORIG_PATH="${PATH}"
 export PATH="./localbin/:${PATH}"
 ln -s /usr/bin/env ./localbin/ostree-env
-${CMD_PREFIX} ostree env --help >out.txt
-assert_file_has_content out.txt "with an empty environment"
+export A_CUSTOM_TEST_FLAG="myvalue"
+${CMD_PREFIX} ostree env >out.txt
+assert_file_has_content out.txt "^A_CUSTOM_TEST_FLAG=myvalue"
+PATH="${ORIG_PATH}"
+export -n A_CUSTOM_TEST_FLAG
 rm -rf -- localbin
 
 echo 'ok CLI extension localbin ostree-env'