summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-09-30 17:47:26 +0200
committerVijay Bellur <vbellur@redhat.com>2014-10-03 02:00:46 -0700
commit7e76bd24305ee29506dd11be5a0691cfa65b6d0c (patch)
tree353e5ab7a64358418db794e52ddc7312b1a04d0b /tests
parent0a8371bdfdd88e662d09def717cc0b822feb64e8 (diff)
ec: Add state dump support
Change-Id: I4504f3050674dde217e79af28cb4d2b5370fe2d5 BUG: 1148010 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8891 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Emmanuel Dreyfus <manu@netbsd.org> Tested-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/ec/statedump.t26
-rw-r--r--tests/volume.rc24
2 files changed, 50 insertions, 0 deletions
diff --git a/tests/basic/ec/statedump.t b/tests/basic/ec/statedump.t
new file mode 100644
index 00000000000..6881c7f8c27
--- /dev/null
+++ b/tests/basic/ec/statedump.t
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 redundancy 1 $H0:$B0/${V0}{0..2}
+TEST $CLI volume start $V0
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
+
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" ec_child_up_status $V0 0 0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" ec_child_up_status $V0 0 1
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" ec_child_up_status $V0 0 2
+
+TEST kill_brick $V0 $H0 $B0/${V0}0
+
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "2" ec_child_up_count $V0 0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "0" ec_child_up_status $V0 0 0
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" ec_child_up_status $V0 0 1
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" ec_child_up_status $V0 0 2
+
+cleanup
diff --git a/tests/volume.rc b/tests/volume.rc
index 009f58b7c60..a216ba5fb7f 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -110,6 +110,30 @@ function afr_child_up_status {
_afr_child_up_status $vol $brick_id generate_mount_statedump
}
+function ec_get_info {
+ local vol=$1
+ local dist_id=$2
+ local key=$3
+ local fpath=$(generate_mount_statedump $vol)
+ local value=$(sed -n "/^\[cluster\/disperse\.$vol-disperse-$dist_id\]/,/^\[/{s/^$key=\(.*\)/\1/p;}" $fpath | head -1)
+ rm -f $fpath
+ echo "$value"
+}
+
+function ec_child_up_status {
+ local vol=$1
+ local dist_id=$2
+ local brick_id=$(($3 + 1))
+ local mask=$(ec_get_info $vol $dist_id "childs_up_mask")
+ echo "${mask: -$brick_id:1}"
+}
+
+function ec_child_up_count {
+ local vol=$1
+ local dist_id=$2
+ ec_get_info $vol $dist_id "childs_up"
+}
+
function get_shd_process_pid {
local vol=$1
ps auxww | grep glusterfs | grep -E "glustershd/run/glustershd.pid" | awk '{print $2}' | head -1