summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/changelog/bug-1211327.t48
-rw-r--r--tests/changelog.rc4
-rw-r--r--tests/volume.rc5
3 files changed, 57 insertions, 0 deletions
diff --git a/tests/bugs/changelog/bug-1211327.t b/tests/bugs/changelog/bug-1211327.t
new file mode 100644
index 00000000000..19d6e76ecab
--- /dev/null
+++ b/tests/bugs/changelog/bug-1211327.t
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+#Testcase:
+#On brick restart, new HTIME.TSTAMP file should not be created.
+#But on changelog disable/enable HTIME.TSTAMP should be created.
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../changelog.rc
+cleanup;
+
+## Start and create a volume
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume create $V0 $H0:$B0/$V0"1";
+
+## Verify volume is is created
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+
+## Start volume and verify
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+TEST $CLI volume set $V0 changelog.changelog on;
+##Let changelog init complete before killing gluster processes
+sleep 1
+
+TEST killall_gluster;
+sleep 1
+EXPECT 0 online_brick_count;
+
+TEST glusterd;
+TEST pidof glusterd;
+##Let the brick processes starts
+sleep 1;
+
+EXPECT 1 online_brick_count;
+
+##On brick restart only one HTIME should be found.
+EXPECT 1 count_htime_files;
+
+##On changelog disable/enable, new HTIME should be created.
+TEST $CLI volume set $V0 changelog.changelog off;
+TEST $CLI volume set $V0 changelog.changelog on;
+EXPECT 2 count_htime_files;
+
+cleanup;
diff --git a/tests/changelog.rc b/tests/changelog.rc
new file mode 100644
index 00000000000..e3b040226ec
--- /dev/null
+++ b/tests/changelog.rc
@@ -0,0 +1,4 @@
+
+function count_htime_files {
+ ls -l $B0/$V0"1"/.glusterfs/changelogs/htime/ | grep HTIME | wc -l
+}
diff --git a/tests/volume.rc b/tests/volume.rc
index 6c0e6abea83..b0211cbe2fc 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -410,6 +410,11 @@ function volume_exists() {
fi
}
+function killall_gluster() {
+ pkill gluster
+ sleep 1
+}
+
function afr_get_index_count {
local brick=$1
ls $1/.glusterfs/indices/xattrop | grep -v xattrop | wc -l