diff options
author | Xavier Hernandez <jahernan@redhat.com> | 2018-01-19 12:18:13 +0100 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-05-09 09:24:10 +0000 |
commit | aee9e3d27f56e4c0c2f981f20b15189eb7ffce51 (patch) | |
tree | 7b1281112c04cf30577277ad3ae0485f89f0e331 /tests/bugs/replicate/bug-1180545.t | |
parent | 84b7cc57df065e2d8c0ac88b179aab3614ec814a (diff) |
tests: improve and fix some test scripts
Change-Id: Iceefe22af754096c599dc570d4894d14fce4deae
Updates: bz#1193929
Signed-off-by: Xavier Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'tests/bugs/replicate/bug-1180545.t')
-rw-r--r-- | tests/bugs/replicate/bug-1180545.t | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/bugs/replicate/bug-1180545.t b/tests/bugs/replicate/bug-1180545.t index ccf51d8b8a6..5e40edd6c38 100644 --- a/tests/bugs/replicate/bug-1180545.t +++ b/tests/bugs/replicate/bug-1180545.t @@ -7,6 +7,31 @@ . $(dirname $0)/../../volume.rc . $(dirname $0)/../../afr.rc +function check_sh_entries() { + local expected="$1" + local count= + local good="0" + shift + + for i in $*; do + count="$(count_sh_entries $i)" + if [[ "x${count}" == "x${expected}" ]]; then + good="$((good + 1))" + fi + done + if [[ "x${good}" != "x${last_good}" ]]; then + last_good="${good}" +# This triggers a sweep of the heal index. However if more than one brick +# tries to heal the same directory at the same time, one of them will take +# the lock and the other will give up, waiting for the next heal cycle, which +# is set to 60 seconds (the minimum valid value). So, each time we detect +# that one brick has completed the heal, we trigger another heal. + $CLI volume heal $V0 + fi + + echo "${good}" +} + cleanup; TEST glusterd @@ -15,6 +40,7 @@ TEST pidof glusterd TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1} TEST $CLI volume set $V0 cluster.heal-timeout 60 TEST $CLI volume set $V0 cluster.self-heal-daemon off +TEST $CLI volume set $V0 stat-prefetch off TEST $CLI volume start $V0 TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; @@ -38,10 +64,13 @@ TEST $CLI volume set $V0 cluster.self-heal-daemon on EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 + TEST $CLI volume heal $V0 -EXPECT_WITHIN $HEAL_TIMEOUT '2' count_sh_entries $B0/brick0 -EXPECT_WITHIN $HEAL_TIMEOUT '2' count_sh_entries $B0/brick1 +last_good="" + +EXPECT_WITHIN $HEAL_TIMEOUT "2" check_sh_entries 2 $B0/brick{0,1} + #Two entries for DIR and two for FILE EXPECT_WITHIN $HEAL_TIMEOUT "4" get_pending_heal_count $V0 TEST diff <(ls $B0/brick0/DIR) <(ls $B0/brick1/DIR) |