bunpen: cleanup the integration test infrastructure
This commit is contained in:
@@ -1,16 +1,49 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -xeu
|
set -eu
|
||||||
|
|
||||||
# trivial:
|
die() {
|
||||||
bunpen --bunpen-path / $(which true)
|
echo "$1"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
test_01_trivial() {
|
||||||
|
bunpen --bunpen-path / /usr/bin/env true
|
||||||
|
}
|
||||||
|
|
||||||
# invoke by path
|
# invoke by path
|
||||||
bunpen --bunpen-path / true
|
test_02_invoke_by_path() {
|
||||||
|
bunpen --bunpen-path / true
|
||||||
|
}
|
||||||
|
|
||||||
|
# invoke disabled
|
||||||
|
test_03_disable_by_env_var() {
|
||||||
|
BUNPEN_DISABLE=1 bunpen true
|
||||||
|
}
|
||||||
|
|
||||||
|
# propagate exit code when disabled (i.e. it exec's)
|
||||||
|
test_04_propagates_rc_when_disabled() {
|
||||||
|
BUNPEN_DISABLE=1 bunpen false && exit false || true
|
||||||
|
}
|
||||||
|
|
||||||
|
# propagate exit code
|
||||||
|
test_05_propagates_rc() {
|
||||||
|
bunpen --bunpen-path / false && exit false || true
|
||||||
|
}
|
||||||
|
|
||||||
# forwards stdout
|
# forwards stdout
|
||||||
stdout=$(bunpen --bunpen-path / echo "hello")
|
test_06_forwards_stdout() {
|
||||||
test "$stdout" -eq "hello"
|
local stdout=$(bunpen --bunpen-path / echo "hello")
|
||||||
|
test "$stdout" -eq "hello"
|
||||||
|
}
|
||||||
|
|
||||||
# forwards exit code
|
for f in $(declare -F); do
|
||||||
bunpen --bunpen-path / false && exit false || true
|
if [[ "$f" =~ test_* ]]; then
|
||||||
|
echo -n "$f: ..."
|
||||||
|
"$f" && echo " SUCCESS" || die " FAIL"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# for n in {01..06}; do
|
||||||
|
# $("test_$n_*)
|
||||||
|
# done
|
||||||
|
Reference in New Issue
Block a user