tests/cli-extensions: tweak test logic

This updates the test logic for CLI extensions, actually checking
for functional output from the subcommand.
It also cleans up some environmental leftover.
This commit is contained in:
Luca BRUNO 2021-12-21 10:16:36 +00:00
parent 7c6719995d
commit 5dbe37ce78
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E
1 changed files with 6 additions and 2 deletions

View File

@ -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'