summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2015-12-21 12:07:51 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-12-28 03:03:21 -0800
commita370013898585a87657ae41e4f266da5d98cc5d2 (patch)
tree579e410bec02a2d3c91faaa60942af9697699559 /tests/bugs
parent78305ce9604329250dd4a9f2335587957d71c701 (diff)
tests: handle bad objects during lookup/inode_refresh
Change-Id: I1848f0e9243c9376e0deba6738757350fe8b704a BUG: 1290965 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/13044 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t b/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t
new file mode 100644
index 00000000000..393d1448075
--- /dev/null
+++ b/tests/bugs/replicate/bug-1290965-detect-bitrotten-objects.t
@@ -0,0 +1,53 @@
+#!/bin/bash
+#Self-heal tests
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1}
+TEST $CLI volume set $V0 self-heal-daemon off
+TEST $CLI volume set $V0 entry-self-heal off
+TEST $CLI volume set $V0 metadata-self-heal off
+TEST $CLI volume set $V0 data-self-heal off
+TEST $CLI volume set $V0 performance.stat-prefetch off
+TEST $CLI volume start $V0
+TEST $CLI volume attach-tier $V0 replica 2 $H0:$B0/brick{2,3}
+TEST $CLI volume bitrot $V0 enable
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count
+TEST $CLI volume bitrot $V0 scrub-frequency hourly
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0
+TEST dd if=/dev/urandom of=$M0/FILE bs=1024 count=1
+
+#Corrupt file from back-end
+TEST stat $B0/brick3/FILE
+echo "Corrupted data" >> $B0/brick3/FILE
+#Manually set bad-file xattr since we can't wait for an hour.
+TEST setfattr -n trusted.bit-rot.bad-file -v 0x3100 $B0/brick3/FILE
+
+TEST $CLI volume stop $V0
+TEST $CLI volume start $V0
+EXPECT 'Started' volinfo_field $V0 'Status';
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick0
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick1
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick2
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/brick3
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 3
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count
+#Trigger lookup so that bitrot xlator marks file as bad in its inode context.
+stat $M0/FILE
+# Remove hot-tier
+TEST $CLI volume tier $V0 detach start
+sleep 1
+EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" detach_tier_status_field $V0
+TEST $CLI volume tier $V0 detach commit
+#Test that file has migrated to cold tier.
+EXPECT "1024" stat -c "%s" $B0/brick0/FILE
+EXPECT "1024" stat -c "%s" $B0/brick1/FILE
+TEST umount $M0
+cleanup