From c78d07fb8efdd5f63284332473852619d5da4244 Mon Sep 17 00:00:00 2001 From: Niklas Hambüchen Date: Tue, 28 Feb 2017 14:05:59 +0100 Subject: tests: Fix and enable split-brain-healing mtime check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-on: https://review.gluster.org/16789 Reviewed-by: Ravishankar N Tested-by: Ravishankar N Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Niklas Hambüchen --- tests/basic/afr/split-brain-healing.t | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'tests/basic/afr') 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 -- cgit