diff options
author | Niklas Hambüchen <mail@nh2.me> | 2017-02-28 14:05:59 +0100 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2017-03-01 12:29:38 -0500 |
commit | c78d07fb8efdd5f63284332473852619d5da4244 (patch) | |
tree | 5bb1977115dc02cc7f63cb17c828da4bf87c3c1e | |
parent | 67a35ac54bfd61a920c1919fbde588a04ac3358a (diff) |
tests: Fix and enable split-brain-healing mtime check
This test was commented out with the belief that it depended
on utimensat() support, but in fact it was not necessary because
`stat -c %Y` only outputs second resolution.
Simply commenting in the test made it fail because it checked
the values *before* the heal, while intended was to check them
*after* the heal. This commit fixes that.
Change-Id: I4194ac645b365a1f906a3ac9bcbbdb1f05000e27
BUG: 1422074
Signed-off-by: Niklas Hambüchen <mail@nh2.me>
Reviewed-on: https://review.gluster.org/16789
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Tested-by: Ravishankar N <ravishankar@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niklas Hambüchen
-rw-r--r-- | tests/basic/afr/split-brain-healing.t | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/tests/basic/afr/split-brain-healing.t b/tests/basic/afr/split-brain-healing.t index 403d08faab3..8b7eaffb268 100644 --- a/tests/basic/afr/split-brain-healing.t +++ b/tests/basic/afr/split-brain-healing.t @@ -167,9 +167,24 @@ fi $CLI volume heal $V0 split-brain latest-mtime /file5 EXPECT "0" echo $? -#TODO: Uncomment the below after posix_do_utimes() supports utimensat(2) accuracy -#TEST [ $LATEST_MTIME -eq $mtime1 ] -#TEST [ $LATEST_MTIME -eq $mtime2 ] +if [ $subvolume == 0 ] +then + mtime1_after_heal=$(stat -c %Y $B0/${V0}1/file5) + mtime2_after_heal=$(stat -c %Y $B0/${V0}2/file5) +elif [ $subvolume == 1 ] +then + mtime1_after_heal=$(stat -c %Y $B0/${V0}3/file5) + mtime2_after_heal=$(stat -c %Y $B0/${V0}4/file5) +fi + +#TODO: To below comparisons on full sub-second resolution + +TEST [ $LATEST_MTIME -eq $mtime1_after_heal ] +TEST [ $LATEST_MTIME -eq $mtime2_after_heal ] + +mtime_mount_after_heal=$(stat -c %Y file5) + +TEST [ $LATEST_MTIME -eq $mtime_mount_after_heal ] ################ Heal file6 using the latest-mtime option and its gfid ############## subvolume=$(get_replicate_subvol_number file6) @@ -190,9 +205,24 @@ GFIDSTR="gfid:$(gf_gfid_xattr_to_str $GFID)" $CLI volume heal $V0 split-brain latest-mtime $GFIDSTR EXPECT "0" echo $? -#TODO: Uncomment the below after posix_do_utimes() supports utimensat(2) accuracy -#TEST [ $LATEST_MTIME -eq $mtime1 ] -#TEST [ $LATEST_MTIME -eq $mtime2 ] +if [ $subvolume == 0 ] +then + mtime1_after_heal=$(stat -c %Y $B0/${V0}1/file6) + mtime2_after_heal=$(stat -c %Y $B0/${V0}2/file6) +elif [ $subvolume == 1 ] +then + mtime1_after_heal=$(stat -c %Y $B0/${V0}3/file6) + mtime2_after_heal=$(stat -c %Y $B0/${V0}4/file6) +fi + +#TODO: To below comparisons on full sub-second resolution + +TEST [ $LATEST_MTIME -eq $mtime1_after_heal ] +TEST [ $LATEST_MTIME -eq $mtime2_after_heal ] + +mtime_mount_after_heal=$(stat -c %Y file6) + +TEST [ $LATEST_MTIME -eq $mtime_mount_after_heal ] ################ Heal remaining SB'ed files of replica_0 using B1 as source ############## $CLI volume heal $V0 split-brain source-brick $H0:$B0/${V0}1 |