summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-11-09 22:42:22 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-11-12 11:28:13 +0000
commit76a83f98b78a0bdf29bbb0f8e4c9ab74dae52be4 (patch)
tree8acb9986e1377f8222912d97eabac2090ddcbdc2
parent781bc5bd68824cae4456855823be17f43b5ae683 (diff)
tests: fix bug-1483058-replace-brick-quorum-validation.t spurious failure
Change-Id: I04c35305bfb663eabbf715eee78695adfd4a2d20 BUG: 1511310 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--tests/bugs/glusterd/bug-1483058-replace-brick-quorum-validation.t9
-rw-r--r--tests/cluster.rc10
-rw-r--r--tests/include.rc1
3 files changed, 19 insertions, 1 deletions
diff --git a/tests/bugs/glusterd/bug-1483058-replace-brick-quorum-validation.t b/tests/bugs/glusterd/bug-1483058-replace-brick-quorum-validation.t
index 3dbe28a7917..2d9e5287818 100644
--- a/tests/bugs/glusterd/bug-1483058-replace-brick-quorum-validation.t
+++ b/tests/bugs/glusterd/bug-1483058-replace-brick-quorum-validation.t
@@ -45,7 +45,14 @@ TEST start_glusterd 2
EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count
+# checking peer_count is not enough to call that quorum is regained as
+# peer_count is based on peerinfo->connected where as quorum is calculated based
+# on peerinfo->quorum_contrib. To avoid this spurious race of replace brick
+# commit force to execute and fail before the quorum is regained run the command
+# in EXPECT_WITHIN to ensure that with multiple attempts the command goes
+# through once the quorum is regained.
+
# Now quorum is met. replace-brick will execute successfuly
-TEST $CLI_1 volume replace-brick $V0 $H2:$B2/${V0}1 $H1:$B1/${V0}1_new commit force
+EXPECT_WITHIN $PEER_SYNC_TIMEOUT 0 attempt_replace_brick 1 $V0 $H2:$B2/${V0}1 $H1:$B1/${V0}1_new
#cleanup;
diff --git a/tests/cluster.rc b/tests/cluster.rc
index c1ff8ab5b74..e258b586847 100644
--- a/tests/cluster.rc
+++ b/tests/cluster.rc
@@ -142,6 +142,16 @@ function peer_count() {
$CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l
}
+function attempt_replace_brick {
+ local cli_no=$1
+ local vol=$2;
+ local src_brick=$3;
+ local dst_brick=$4;
+
+ eval \$CLI_$cli_no volume replace-brick $vol $src_brick $dst_brick commit force;
+ echo $?
+}
+
function cluster_rebalance_status_field {
#The rebalance status can be up to 3 words, (e.g.:'fix-layout in progress'), hence the awk-print $7 thru $9.
#But if the status is less than 3 words, it also prints the next field i.e the run_time_in_secs.(e.g.:'completed 3.00').
diff --git a/tests/include.rc b/tests/include.rc
index 7cd15a2d249..f3b94336179 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -74,6 +74,7 @@ PROCESS_UP_TIMEOUT=30
NFS_EXPORT_TIMEOUT=20
CHILD_UP_TIMEOUT=20
PROBE_TIMEOUT=60
+PEER_SYNC_TIMEOUT=20
REBALANCE_TIMEOUT=360
REOPEN_TIMEOUT=20
HEAL_TIMEOUT=80