summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorbryan <bryan.sullivan@att.com>2017-02-07 08:15:43 -0800
committerbryan <bryan.sullivan@att.com>2017-02-07 08:16:38 -0800
commitfed22cace3e087762d6110c51a252891a4640f3b (patch)
tree1bf93785b427e4f8a5e6a5b7fc95a3edb720e608 /tests
parentae516ac1821822a4034b77cad82805ab8d7a0f9e (diff)
Add fail trap and success functions to network_bridging test
JIRA: COPPER-4 Change-Id: I1f2d91211de0d392a2931e3b033f123496162ae3 Signed-off-by: bryan <bryan.sullivan@att.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/network_bridging-clean.sh26
-rw-r--r--tests/network_bridging.sh2
2 files changed, 20 insertions, 8 deletions
diff --git a/tests/network_bridging-clean.sh b/tests/network_bridging-clean.sh
index a9bd909..477918d 100644
--- a/tests/network_bridging-clean.sh
+++ b/tests/network_bridging-clean.sh
@@ -24,12 +24,26 @@
# How to use:
# $ bash network_bridging-clean.sh
+trap 'fail' ERR
-if [ $# -eq 1 ]; then
- if [ $1 == "debug" ]; then
- set -x #echo on
- fi
-fi
+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
+}
+
+unclean() {
+ echo "Unclean environment!"
+ fail
+}
echo "Get Congress policy 'test' ID"
test_policy_ID=$(openstack congress policy show test | awk "/ id / { print \$4 }")
@@ -71,5 +85,5 @@ neutron subnet-delete test_admin
echo "Delete test_admin network"
neutron net-delete test_admin
-set +x #echo off
+pass
diff --git a/tests/network_bridging.sh b/tests/network_bridging.sh
index 7edd8f9..214ae87 100644
--- a/tests/network_bridging.sh
+++ b/tests/network_bridging.sh
@@ -191,6 +191,4 @@ done
echo "$0: $(date) Verify cirros1 is paused:" $RESULT
if [ "$RESULT" == "Test Failed!" ]; then fail; fi
-set +x #echo off
-
pass