summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2016-02-12 14:57:47 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-31 10:13:17 -0700
commitb4cbfdac0d35e6896f337b4ae7b75dcf4e714a1a (patch)
tree290ece66f510129a16ea8dd44dbd5d89a24613ec /tests
parentb2a5eed9b17a82ec4b6366b0107fe2271328c16a (diff)
nsr: Introducing a happy path test case
Write infra for nsr_server to not send a CHILD_UP before it gets a CHILD_UP from a quorum of it's children. Using the CHILD_UP received in the nsr client translator from the server, to decide the right time for starting the I/Os Change-Id: I9551638b306bdcbc6bae6aeda00316576ea832fe Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/13623 CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/basic/nsr/nsr.t33
-rw-r--r--tests/volume.rc18
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/basic/nsr/nsr.t b/tests/basic/nsr/nsr.t
new file mode 100755
index 00000000000..b5a4aaf1058
--- /dev/null
+++ b/tests/basic/nsr/nsr.t
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../cluster.rc
+. $(dirname $0)/../../snapshot.rc
+
+cleanup;
+
+TEST verify_lvm_version;
+#Create cluster with 3 nodes
+TEST launch_cluster 3;
+TEST setup_lvm 3
+
+TEST $CLI_1 peer probe $H2;
+TEST $CLI_1 peer probe $H3;
+EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count;
+
+TEST $CLI_1 volume create $V0 replica 3 $H1:$L1 $H2:$L2 $H3:$L3
+TEST $CLI_1 volume set $V0 cluster.nsr on
+#TEST $CLI_1 volume set $V0 diagnostics.brick-log-level DEBUG
+TEST $CLI_1 volume start $V0
+
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H1 --entry-timeout=0 $M0;
+
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" nsrc_child_up_status $V0 0
+
+echo "file" > $M0/file1
+TEST stat $L1/file1
+TEST stat $L2/file1
+TEST stat $L3/file1
+
+cleanup;
diff --git a/tests/volume.rc b/tests/volume.rc
index e488aa73b1c..71b40b72d66 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -110,6 +110,24 @@ function snap_client_connected_status {
echo "$up"
}
+function _nsrc_child_up_status {
+ local vol=$1
+ #brick_id is (brick-num in volume info - 1)
+ local brick_id=$2
+ local gen_state_dump=$3
+ local fpath=$($gen_state_dump $vol)
+ up=$(grep -a -B1 child_$brick_id=$vol-client-$brick_id $fpath | head -1 | cut -f2 -d'=')
+ rm -f $fpath
+ echo "$up"
+}
+
+function nsrc_child_up_status {
+ local vol=$1
+ #brick_id is (brick-num in volume info - 1)
+ local brick_id=$2
+ _nsrc_child_up_status $vol $brick_id generate_mount_statedump
+}
+
function _afr_child_up_status {
local vol=$1
#brick_id is (brick-num in volume info - 1)