diff options
author | Kaushal M <kaushal@redhat.com> | 2013-01-17 18:01:35 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-01-17 20:56:28 -0800 |
commit | 165044cee54ceaa8f0adec6d571e9ad54f4f8e5d (patch) | |
tree | 78f145037dc772e9f49e47351f297123f00be7b0 /tests/bugs | |
parent | d177372ee732acc3b2ce7a395d83f8c03ec19ce2 (diff) |
tests: Fix tests for bug 857330
Changed some tests to use EXPECT, which I should have done originally, instead
of using TEST. With recent changes to the EXPECT primitive we get more info for
failures, which hopefully will make debugging of the intermittent failures of
these tests easier.
Change-Id: If763dcfb7e370a3f360277c3c183b950aede5685
BUG: 857330
Signed-off-by: Kaushal M <kaushal@redhat.com>
Reviewed-on: http://review.gluster.org/4390
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/bug-857330/common.rc | 27 | ||||
-rwxr-xr-x | tests/bugs/bug-857330/normal.t | 6 | ||||
-rwxr-xr-x | tests/bugs/bug-857330/xml.t | 16 |
3 files changed, 15 insertions, 34 deletions
diff --git a/tests/bugs/bug-857330/common.rc b/tests/bugs/bug-857330/common.rc index 40da95e8c33..4e5a73a0bb1 100644 --- a/tests/bugs/bug-857330/common.rc +++ b/tests/bugs/bug-857330/common.rc @@ -20,19 +20,10 @@ function check-and-store-task-id() return 0; } -function check-with-stored-task-id() +function get-task-id() { - local task_id=$($CLI $COMMAND | grep $PATTERN | grep -o -E "$UUID_REGEX") - - if [ -z "$task_id" ] && [ "${task_id+asdf}" = "asdf" ]; then - return 1 - fi + $CLI $COMMAND | grep $PATTERN | grep -o -E "$UUID_REGEX" - if [ "$TASK_ID" != "$task_id" ]; then - return 1 - fi - - return 0 } function check-and-store-task-id-xml() @@ -49,19 +40,9 @@ function check-and-store-task-id-xml() return 0; } -function check-with-stored-task-id-xml() +function get-task-id-xml() { - local task_id=$($CLI $COMMAND --xml | xmllint --format - | grep $PATTERN | grep -o -E "$UUID_REGEX") - - if [ -z "$task_id" ] && [ "${task_id+asdf}" = "asdf" ]; then - return 1 - fi - - if [ "$TASK_ID" != "$task_id" ]; then - return 1 - fi - - return 0 + $CLI $COMMAND --xml | xmllint --format - | grep $PATTERN | grep -o -E "$UUID_REGEX" } function get-task-status() diff --git a/tests/bugs/bug-857330/normal.t b/tests/bugs/bug-857330/normal.t index abf8e2ac503..4455d162036 100755 --- a/tests/bugs/bug-857330/normal.t +++ b/tests/bugs/bug-857330/normal.t @@ -29,7 +29,7 @@ TEST check-and-store-task-id COMMAND="volume status $V0" PATTERN="Rebalance" -TEST check-with-stored-task-id +EXPECT $TASK_ID get-task-id COMMAND="volume rebalance $V0 status" PATTERN="completed" @@ -46,7 +46,7 @@ TEST check-and-store-task-id COMMAND="volume status $V0" PATTERN="Replace" -TEST check-with-stored-task-id +EXPECT $TASK_ID get-task-id COMMAND="volume replace-brick $V0 $REP_BRICK_PAIR status" PATTERN="complete" @@ -63,7 +63,7 @@ TEST check-and-store-task-id COMMAND="volume status $V0" PATTERN="Remove" -TEST check-with-stored-task-id +EXPECT $TASK_ID get-task-id COMMAND="volume remove-brick $V0 $H0:$B0/${V0}3 status" PATTERN="completed" diff --git a/tests/bugs/bug-857330/xml.t b/tests/bugs/bug-857330/xml.t index a6e0b34cace..688f4661941 100755 --- a/tests/bugs/bug-857330/xml.t +++ b/tests/bugs/bug-857330/xml.t @@ -30,11 +30,11 @@ TEST check-and-store-task-id-xml COMMAND="volume status $V0" PATTERN="id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml COMMAND="volume rebalance $V0 status" PATTERN="task-id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml ## TODO: Add tests for rebalance stop @@ -53,11 +53,11 @@ TEST check-and-store-task-id-xml COMMAND="volume status $V0" PATTERN="id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml COMMAND="volume replace-brick $V0 $REP_BRICK_PAIR status" PATTERN="task-id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml ## TODO: Add more tests for replace-brick pause|abort @@ -67,7 +67,7 @@ EXPECT_WITHIN 300 $PATTERN get-task-status COMMAND="volume replace-brick $V0 $REP_BRICK_PAIR commit" PATTERN="task-id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml ################## ## Remove-brick ## @@ -78,11 +78,11 @@ TEST check-and-store-task-id-xml COMMAND="volume status $V0" PATTERN="id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml COMMAND="volume remove-brick $V0 $H0:$B0/${V0}3 status" PATTERN="task-id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml COMMAND="volume remove-brick $V0 $H0:$B0/${V0}3 status" PATTERN="completed" @@ -92,7 +92,7 @@ EXPECT_WITHIN 300 $PATTERN get-task-status COMMAND="volume remove-brick $V0 $H0:$B0/${V0}3 commit" PATTERN="task-id" -TEST check-with-stored-task-id-xml +EXPECT $TASK_ID get-task-id-xml TEST $CLI volume stop $V0; TEST $CLI volume delete $V0; |