diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-08-10 12:46:20 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-08-12 08:27:20 +0000 |
commit | 488dcc17b76b1b46c13ccd269b7a092c014a4d94 (patch) | |
tree | edef46562cc87b0ef66f336f7ea25e0433eb26f4 /tests/bugs/replicate | |
parent | bd8fc26a278697c30537d879ea5402db7ebab577 (diff) |
Make sure EXPECT_WITHIN executes the statement multiple times
When we pass a command to be executed in EXPECT_WITHIN and we use ``
the value is passed by value, so if the first execution gives a result
that is different from the expected value, EXPECT_WITHIN test will
fail because the command will not be re-evaluated. Changed the
expression with `` to a function. Added sleep(3) in afr.c for
reconfigure to both RC and re-test after the change.
fixes bz#1614662
Change-Id: I3bc8a75b996729261aa48067f6ed8da9c6273b13
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'tests/bugs/replicate')
-rw-r--r-- | tests/bugs/replicate/bug-1448804-check-quorum-type-values.t | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/bugs/replicate/bug-1448804-check-quorum-type-values.t b/tests/bugs/replicate/bug-1448804-check-quorum-type-values.t index 4b654e704c5..5bacf3edcfe 100644 --- a/tests/bugs/replicate/bug-1448804-check-quorum-type-values.t +++ b/tests/bugs/replicate/bug-1448804-check-quorum-type-values.t @@ -1,6 +1,7 @@ #!/bin/bash . $(dirname $0)/../../include.rc . $(dirname $0)/../../volume.rc +. $(dirname $0)/../../afr.rc cleanup; TEST glusterd @@ -11,9 +12,8 @@ EXPECT 'Started' volinfo_field $V0 'Status' TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; - # Default quorum-type for replica 2 is none. quorum-count is zero but it is not displayed. -EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "none" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-type|awk '{print $3}'` +EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "none" get_quorum_type $M0 $V0 0 cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-count TEST [ $? -ne 0 ] @@ -22,25 +22,25 @@ TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}2 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2 # Default quorum-type for replica 3 is auto. quorum-count is INT_MAX but it is not displayed. -EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "auto" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-type|awk '{print $3}'` +EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "auto" get_quorum_type $M0 $V0 0 cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-count TEST [ $? -ne 0 ] # Change the type to fixed. TEST $CLI volume set $V0 cluster.quorum-type fixed # We haven't set quorum-count yet, so it takes the default value of zero in reconfigure() and hence the quorum-type is displayed as none. -EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "none" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-type|awk '{print $3}'` +EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "none" get_quorum_type $M0 $V0 0 cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-count TEST [ $? -ne 0 ] # set quorum-count and check. TEST $CLI volume set $V0 cluster.quorum-count 1 -EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "fixed" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-type|awk '{print $3}'` +EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "fixed" get_quorum_type $M0 $V0 0 EXPECT "1" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-count|awk '{print $3}'` # reset to default values. TEST $CLI volume reset $V0 cluster.quorum-type -EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "auto" echo `cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-type|awk '{print $3}'` +EXPECT_WITHIN $CONFIG_UPDATE_TIMEOUT "auto" get_quorum_type $M0 $V0 0 cat $M0/.meta/graphs/active/$V0-replicate-0/private|grep quorum-count TEST [ $? -ne 0 ] |