From 529a79163366a7f82675ab70eb02727ab15f96a8 Mon Sep 17 00:00:00 2001 From: blsaws Date: Thu, 7 Apr 2016 15:14:07 -0700 Subject: Improve success/fail test JIRA: COPPER-4 Change-Id: Id6728c267f67f4a24231b6e7d7826b21d81a9546 Signed-off-by: blsaws (cherry picked from commit 34ba4633e7ca7959f3c83fc0d6ee12171cdd98fe) --- tests/adhoc/dmz01.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/adhoc/dmz01.sh b/tests/adhoc/dmz01.sh index 7ca2b9c..11d657a 100644 --- a/tests/adhoc/dmz01.sh +++ b/tests/adhoc/dmz01.sh @@ -119,15 +119,18 @@ test_cirros1_ID=$(openstack server list | awk "/ cirros1 / { print \$2 }") echo "Get cirros2 instance ID" test_cirros2_ID=$(openstack server list | awk "/ cirros2 / { print \$2 }") -echo "Check for presence of cirros1 ID in Congress policy 'test' table 'dmz_server'" -dmz_cirros1=$(openstack congress policy row list test dmz_server | awk "/ $test_cirros1_ID / { print \$2 }") - -echo "Check for presence of cirros1 ID in Congress policy 'test' table 'dmz_server'" -dmz_cirros2=$(openstack congress policy row list test dmz_server | awk "/ $test_cirros2_ID / { print \$2 }") - echo "Verify cirros1 and cirros2 IDs are in the Congress policy 'test' table 'dmz_server'" -if [ "$dmz_cirros1" == "$test_cirros1_ID" ] && [ "$dmz_cirros2" == "$test_cirros2_ID" ]; then echo "Test Success!" -else echo "Test Failed!" -fi +COUNTER=5 +RESULT="Test Failed!" +until [[ $COUNTER -eq 0 || $RESULT == "Test Success!" ]]; do + echo "Check for presence of cirros1 ID in Congress policy 'test' table 'dmz_server'" + dmz_cirros1=$(openstack congress policy row list test dmz_server | awk "/ $test_cirros1_ID / { print \$2 }") + echo "Check for presence of cirros2 ID in Congress policy 'test' table 'dmz_server'" + dmz_cirros2=$(openstack congress policy row list test dmz_server | awk "/ $test_cirros2_ID / { print \$2 }") + if [ "$dmz_cirros1" == "$test_cirros1_ID" ] && [ "$dmz_cirros2" == "$test_cirros2_ID" ]; then RESULT="Test Success!" + fi + let COUNTER-=1 +done +echo $RESULT set +x #echo off -- cgit 1.2.3-korg