From a6d0b8903f8b0bfac624a2391a83a50e109f6298 Mon Sep 17 00:00:00 2001 From: bryan Date: Tue, 7 Feb 2017 08:24:32 -0800 Subject: Add fail trap and success functions to reserved_subnet test JIRA: COPPER-4 Change-Id: I50c65540662ce2d4bcd7852870ebb850a42d9ec7 Signed-off-by: bryan --- tests/reserved_subnet-clean.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/reserved_subnet-clean.sh b/tests/reserved_subnet-clean.sh index abc4e7e..778a027 100644 --- a/tests/reserved_subnet-clean.sh +++ b/tests/reserved_subnet-clean.sh @@ -30,6 +30,22 @@ # # After test, cleanup # $ bash reserved_subnet-clean.sh +trap 'fail' ERR + +pass() { + echo "Hooray!" + set +x #echo off + exit 0 +} + +# Use this to trigger fail() at the right places +# if [ "$RESULT" == "Test Failed!" ]; then fail; fi +fail() { + echo "Test Failed!" + set +x + exit 1 +} + if [ $# -eq 1 ]; then if [ $1 == "debug" ]; then set -x #echo on @@ -57,4 +73,4 @@ neutron subnet-delete test_public echo "Delete public network" neutron net-delete test_public -set +x #echo off +pass -- cgit 1.2.3-korg