Merge pull request #594 from awh/591_smoke_test_robustness

Improved smoke test robustness

Fixes #591.
This commit is contained in:
rade committed 2015-04-22 16:52:37 +01:00
commit 5749d19fee
4 files changed
+43 -6

No files matched your search

+1 -2
View File
@@ -18,7 +18,6 @@ weave_on $HOST2 launch $HOST1
weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu
weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu
ok=$(exec_on $HOST1 c1 ping -q -c 4 $C2 >&2 && echo ok)
assert "echo $ok" "ok"
assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2"
end_suite
+1 -2
View File
@@ -18,7 +18,6 @@ weave_on $HOST2 launch -password notverysecure $HOST1
weave_on $HOST2 run $C2/24 -t --name=c2 ubuntu
weave_on $HOST1 run $C1/24 -t --name=c1 ubuntu
ok=$(exec_on $HOST1 c1 ping -q -c 4 $C2 >&2 && echo ok)
assert "echo $ok" "ok"
assert_raises "exec_on $HOST1 c1 ping -q -c 4 $C2"
end_suite
+26 -2
View File
@@ -2,6 +2,13 @@
set -e
# Protect against being sourced multiple times to prevent
# overwriting assert.sh global state
if ! [ -z "$SOURCED_CONFIG_SH" ]; then
return
fi
SOURCED_CONFIG_SH=true
# these ought to match what is in Vagrantfile
N_MACHINES=${N_MACHINES:-2}
IP_PREFIX=${IP_PREFIX:-192.168.48}
@@ -28,12 +35,29 @@ remote() {
$@ > >(while read line; do echo -e "\e[0;34m$rem>\e[0m $line"; done)
}
colourise() {
echo -ne '\e['$1'm'
shift
# It's important that we don't do this in a subshell, as some
# commands we execute need to modify global state
"$@"
echo -ne '\e[0m'
}
whitely() {
echo -e '\e[1;37m'`$@`'\e[0m'
colourise '1;37' "$@"
}
greyly () {
echo -e '\e[0;37m'`$@`'\e[0m'
colourise '0;37' "$@"
}
redly() {
colourise '1;31' "$@"
}
greenly() {
colourise '1;32' "$@"
}
run_on() {
+15
View File
@@ -9,6 +9,21 @@ if ! bash ./sanity_check.sh; then
fi
whitely echo ...ok
# Modified version of _assert_cleanup from assert.sh that
# prints overall status
check_test_status() {
if [ $? -ne 0 ]; then
redly echo "---= !!!ABNORMAL TEST TERMINATION!!! =---"
elif [ $tests_suite_status -ne 0 ]; then
redly echo "---= !!!SUITE FAILURES - SEE ABOVE FOR DETAILS!!! =---"
exit $tests_suite_status
else
greenly echo "---= ALL SUITES PASSED =---"
fi
}
# Overwrite assert.sh _assert_cleanup trap with our own
trap check_test_status EXIT
for t in *_test.sh; do
echo
greyly echo "---= Running $t =---"