summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2017-01-12 14:48:28 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-01-25 13:36:29 -0500
commit10076acaddfa611214e42e0402c3578bc69cada9 (patch)
tree4a3d22820a7598d142c579f3a6dbbc7c7804fdb7 /tests
parent34213d9f34df15dbec42e389f327a893799f1c75 (diff)
tests/include : EXPECT_WITHIN takes full time even if expression matches
Problem: For all the tests using get_pending_heal_count, EXPECT_WITHIN is taking full time given to it even if the heal count matches with expected value. Solution: RC - In most of the tests, to check heal count, wildcards are being used. In EXPECT_WITHIN, in if condition, when we use it in double quotes (" "), it gives string with wildcards which does not match with the output of get_pending_heal_count. For example, (0 =~ ^0$). So, "while" loop was running for full time and at the end, after coming out of loop, in next if condition it was matching with the expression without quotes. That is why it was passing. Remove double quotes in "if condition" in EXPECT_WITHIN and match as we are matching it in test_expect_footer. >Change-Id: Ia161594774d05b9b888efb2f7ed1950590d8ac1b >BUG: 1412549 >Signed-off-by: Ashish Pandey <aspandey@redhat.com> >Reviewed-on: https://review.gluster.org/16382 >Smoke: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Raghavendra Talur <rtalur@redhat.com> >Signed-off-by: Ashish Pandey <aspandey@redhat.com> Change-Id: Ia161594774d05b9b888efb2f7ed1950590d8ac1b BUG: 1416285 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: https://review.gluster.org/16467 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/include.rc8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/include.rc b/tests/include.rc
index b83972a111b..4591859cc01 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -235,7 +235,7 @@ function test_expect_not_footer()
err="Got \"$a\" when not expecting it"
fi
- ! [[ "$a" =~ "$e" ]];
+ ! [[ "$a" =~ $e ]];
test_footer "$lineno" "$err";
}
@@ -291,6 +291,10 @@ function _TEST()
test_footer "$TESTLINE";
}
+#This function should be used carefully.
+#The expected regex, given to this function, should be
+#used within ^ and $ to match exactly with the output of
+#command.
function _EXPECT_WITHIN()
{
TESTLINE=$1
@@ -316,7 +320,7 @@ function _EXPECT_WITHIN()
fi
## Check match success
- if [[ "$a" =~ "$e" ]]; then
+ if [[ "$a" =~ $e ]]; then
break;
fi
sleep 1;