summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaravanakumar Arumugam <sarumuga@redhat.com>2015-06-29 20:41:08 +0530
committerVenky Shankar <vshankar@redhat.com>2015-07-27 00:49:44 -0700
commitb23c4b4e22628ab9ddc0c8341360a53d3f9d658d (patch)
treeaf9ac75c80d6a807215c9a29a96b8fef83a2fb33
parent385acc675c512c63f7051d46ad96666ea34cf0b5 (diff)
changelog: test case for verifying empty changelogs avoided
Test case added to check NO EMPTY changelogs gets created over changelog rollover period. Change-Id: I83323644e1a0c4b920a472e1179606a0fd54d1d9 BUG: 1237000 Signed-off-by: Saravanakumar Arumugam <sarumuga@redhat.com> Reviewed-on: http://review.gluster.org/11460 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
-rwxr-xr-xtests/bugs/changelog/bug-1208470.t40
-rw-r--r--tests/changelog.rc5
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/bugs/changelog/bug-1208470.t b/tests/bugs/changelog/bug-1208470.t
new file mode 100755
index 00000000000..526f8f20612
--- /dev/null
+++ b/tests/bugs/changelog/bug-1208470.t
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+## Testcase:
+## Avoid creating any EMPTY changelog(over the changelog rollover time)
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../changelog.rc
+cleanup;
+
+## override current changelog rollover-time
+## to avoid sleeping for long duration.
+CL_RO_TIME=5
+
+## Start and create a volume
+TEST glusterd;
+TEST pidof glusterd;
+TEST $CLI volume create $V0 $H0:$B0/$V0"1";
+
+## Verify volume 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';
+
+## Set changelog ON
+TEST $CLI volume set $V0 changelog.changelog on;
+
+EXPECT 1 count_changelog_files $B0/${V0}1
+
+## Set changelog rollover time
+TEST $CLI volume set $V0 changelog.rollover-time $CL_RO_TIME;
+
+## Wait for changelog rollover time
+sleep $CL_RO_TIME
+
+## NO additional empty changelogs created
+EXPECT 1 count_changelog_files $B0/${V0}1
diff --git a/tests/changelog.rc b/tests/changelog.rc
index e3b040226ec..ffad2e80632 100644
--- a/tests/changelog.rc
+++ b/tests/changelog.rc
@@ -2,3 +2,8 @@
function count_htime_files {
ls -l $B0/$V0"1"/.glusterfs/changelogs/htime/ | grep HTIME | wc -l
}
+
+function count_changelog_files {
+ # Where $1 is the brick name passed
+ ls -l $1/.glusterfs/changelogs/ | grep CHANGELOG | wc -l
+}