summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2018-08-12 15:33:29 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2018-08-13 12:45:38 +0000
commit93c9062ccdf6a5b0461e2ea10ebe8d54d364a243 (patch)
treed6be5a6af759c6d0c5e3367ffd787eb34bcecde4
parentfcf7ac887147e2f96a93165480c70364ee89a870 (diff)
downloadglusterfs-93c9062ccdf6a5b0461e2ea10ebe8d54d364a243.tar.gz
glusterfs-93c9062ccdf6a5b0461e2ea10ebe8d54d364a243.tar.xz
glusterfs-93c9062ccdf6a5b0461e2ea10ebe8d54d364a243.zip
tests/quick-read/bug-846240.t: fix a wrong test
Earlier this test did following things on M0 and M1 mounted on same volume: 1 create file M0/testfile 2 open an fd on M0/testfile 3 remove the file from M1, M1/testfile 4 echo "data" >> M0/testfile The test expects appending data to M0/testfile to fail. However, redirector ">>" creates a file if it doesn't exist. So, the only reason test succeeded was due to lookup succeeding due to stale stat in md-cache. This hypothesis is verified by two experiments: * Add a sleep of 10 seconds before append operation. md-cache cache expires and lookup fails followed by creation of file and hence append succeeds to new file. * set md-cache timeout to 600 seconds and test never fails even with sleep 10 before append operation. Reason is stale stat in md-cache survives sleep 10. So, the spurious nature of failure was dependent on whether lookup is done when stat is present in md-cache or not. The actual test should've been to write to the fd opened in step 2 above. I've changed the test accordingly. Note that this patch also remounts M0 after initial file creation as open-behind disables opening-behind on witnessing a setattr on the inode and touch involves a setattr. On remount, create operation is not done and hence file is opened-behind. Change-Id: I739f255e0a62ff0024f0824dad3539974955df99 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Fixes: bz#1615096
-rwxr-xr-xtests/bugs/quick-read/bug-846240.t5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/bugs/quick-read/bug-846240.t b/tests/bugs/quick-read/bug-846240.t
index c47040de1d..bb997e1001 100755
--- a/tests/bugs/quick-read/bug-846240.t
+++ b/tests/bugs/quick-read/bug-846240.t
@@ -29,6 +29,8 @@ TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR;
TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M1;
TEST touch $M0/testfile;
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
# open the file with the fd as 4
TEST fd=`fd_available`;
@@ -46,8 +48,7 @@ TEST rm -f $M1/testfile;
# the file would have been removed from the mount $M1. open() gets error
# and the write call which is put into a stub (open had to be sent first)
# should unwind with the error received in the open call.
-echo "data" >> $M0/testfile 2>/dev/null 1>/dev/null;
-TEST [ $? -ne 0 ]
+TEST ! fd_write $fd data
TEST fd_close $fd;