summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs/bug-857330/common.rc27
-rwxr-xr-xtests/bugs/bug-857330/normal.t6
-rwxr-xr-xtests/bugs/bug-857330/xml.t16
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;