cb8e9e
From e7c5666b7c8adf72a85a87b19f8aa4da602ae0dd Mon Sep 17 00:00:00 2001
cb8e9e
From: Venky Shankar <vshankar@redhat.com>
cb8e9e
Date: Wed, 17 Jun 2015 22:59:17 +0530
cb8e9e
Subject: [PATCH 154/190] tests/bitrot: Scrub state change tests
cb8e9e
cb8e9e
Change-Id: Ibb4b503e7d723c86ac381ad3747b1198334bd6ad
cb8e9e
BUG: 1232309
cb8e9e
Signed-off-by: Venky Shankar <vshankar@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/51699
cb8e9e
Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
cb8e9e
Tested-by: Raghavendra Bhat <raghavendra@redhat.com>
cb8e9e
---
cb8e9e
 tests/bitrot/br-state-check.t |   81 +++++++++++++++++++++++++++++++++++++++++
cb8e9e
 tests/volume.rc               |    4 +-
cb8e9e
 2 files changed, 83 insertions(+), 2 deletions(-)
cb8e9e
 create mode 100644 tests/bitrot/br-state-check.t
cb8e9e
cb8e9e
diff --git a/tests/bitrot/br-state-check.t b/tests/bitrot/br-state-check.t
cb8e9e
new file mode 100644
cb8e9e
index 0000000..0390df5
cb8e9e
--- /dev/null
cb8e9e
+++ b/tests/bitrot/br-state-check.t
cb8e9e
@@ -0,0 +1,81 @@
cb8e9e
+#!/bin/bash
cb8e9e
+
cb8e9e
+. $(dirname $0)/../include.rc
cb8e9e
+. $(dirname $0)/../volume.rc
cb8e9e
+. $(dirname $0)/../nfs.rc
cb8e9e
+
cb8e9e
+cleanup;
cb8e9e
+
cb8e9e
+TEST glusterd
cb8e9e
+TEST pidof glusterd
cb8e9e
+
cb8e9e
+## Create a distribute volume
cb8e9e
+TEST $CLI volume create $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}2 $H0:$B0/${V0}3;
cb8e9e
+TEST $CLI volume start $V0;
cb8e9e
+
cb8e9e
+## Enable bitrot on volume $V0
cb8e9e
+TEST $CLI volume bitrot $V0 enable
cb8e9e
+
cb8e9e
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_bitd_count
cb8e9e
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" get_scrubd_count
cb8e9e
+
cb8e9e
+## perform a series of scrub related state change tests. As of now, there'
cb8e9e
+## no way to check if a given change has been correctly acknowledged by
cb8e9e
+## the scrub process as there isn't an _interface_ to check scrub internal
cb8e9e
+## state (yet). What's been verified here is scrub state machine execution
cb8e9e
+## w.r.t. locking and faults.
cb8e9e
+
cb8e9e
+## 0x0: verify scrub rescheduling
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency monthly
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency daily
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency hourly
cb8e9e
+
cb8e9e
+## 0x1: test reschedule after pause/resume
cb8e9e
+TEST $CLI volume bitrot $V0 scrub pause
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency daily
cb8e9e
+TEST $CLI volume bitrot $V0 scrub resume
cb8e9e
+
cb8e9e
+## 0x2: test reschedule w/ an offline brick
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}1
cb8e9e
+
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency hourly
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-throttle aggressive
cb8e9e
+
cb8e9e
+## 0x3: test pause/resume w/ an offline brick
cb8e9e
+TEST $CLI volume bitrot $V0 scrub pause
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency monthly
cb8e9e
+TEST $CLI volume bitrot $V0 scrub resume
cb8e9e
+
cb8e9e
+## 0x4: test "start" from a paused scrub state
cb8e9e
+
cb8e9e
+TEST $CLI volume bitrot $V0 scrub pause
cb8e9e
+TEST $CLI volume start $V0 force
cb8e9e
+
cb8e9e
+## 0x4a: try pausing an already paused scrub
cb8e9e
+TEST ! $CLI volume bitrot $V0 scrub pause
cb8e9e
+
cb8e9e
+## 0x4b: perform configuration changes
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-frequency hourly
cb8e9e
+TEST $CLI volume bitrot $V0 scrub-throttle lazy
cb8e9e
+TEST $CLI volume bitrot $V0 scrub resume
cb8e9e
+
cb8e9e
+## 0x5: test cleanup upon brick going offline
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}1
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}2
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}3
cb8e9e
+
cb8e9e
+## 0x6: test cleanup upon brick going offline when srubber is paused
cb8e9e
+##      (initially paused and otherwise)
cb8e9e
+
cb8e9e
+## 0x6a: initially paused case
cb8e9e
+TEST $CLI volume bitrot $V0 scrub pause
cb8e9e
+TEST $CLI volume start $V0 force
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}3
cb8e9e
+TEST $CLI volume bitrot $V0 scrub resume
cb8e9e
+
cb8e9e
+## 0x6b: paused _after_ execution
cb8e9e
+TEST $CLI volume start $V0 force
cb8e9e
+TEST $CLI volume bitrot $V0 scrub pause
cb8e9e
+TEST kill_brick $V0 $H0 $B0/${V0}2
cb8e9e
+
cb8e9e
+cleanup;
cb8e9e
diff --git a/tests/volume.rc b/tests/volume.rc
cb8e9e
index 5a7d034..47ca722 100644
cb8e9e
--- a/tests/volume.rc
cb8e9e
+++ b/tests/volume.rc
cb8e9e
@@ -536,10 +536,10 @@ fi
cb8e9e
 }
cb8e9e
 
cb8e9e
 function get_bitd_count {
cb8e9e
-        ps auxw | grep glusterfs | grep bitd.pid | grep -v grep | wc -l
cb8e9e
+        ps auxww | grep glusterfs | grep bitd.pid | grep -v grep | wc -l
cb8e9e
 }
cb8e9e
 
cb8e9e
 function get_scrubd_count {
cb8e9e
-        ps auxw | grep glusterfs | grep scrub.pid | grep -v grep | wc -l
cb8e9e
+        ps auxww | grep glusterfs | grep scrub.pid | grep -v grep | wc -l
cb8e9e
 }
cb8e9e
 
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e