summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSachin Pandit <spandit@redhat.com>2014-10-21 07:57:22 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-11-12 03:20:10 -0800
commit70b0c7b725408fc82969e15dcf67cd352b0fb68b (patch)
tree52afb0d6aeec158cebdef6901a3cc6404e5e2c2d /tests
parenta5e5813aeec36dbbfaa3b9821618d24972a1bf2f (diff)
USS : Display only the activated snapshots
Instead of displaying all the snapshots in the uss world, it is better if we display only the activated snapshots. Change-Id: I70d3ec212b62ec15956ae3e826bc4201d8dedd17 BUG: 1155042 Signed-off-by: Sachin Pandit <spandit@redhat.com> Reviewed-on: http://review.gluster.org/8958 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bug-1155042-dont-display-deactivated-snapshots.t35
-rwxr-xr-xtests/snapshot.rc6
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/bugs/bug-1155042-dont-display-deactivated-snapshots.t b/tests/bugs/bug-1155042-dont-display-deactivated-snapshots.t
new file mode 100644
index 00000000000..34c068f6713
--- /dev/null
+++ b/tests/bugs/bug-1155042-dont-display-deactivated-snapshots.t
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../snapshot.rc
+
+cleanup;
+
+TEST init_n_bricks 2
+TEST setup_lvm 2
+TEST glusterd;
+
+TEST $CLI volume create $V0 $H0:$L1 $H0:$L2
+TEST $CLI volume start $V0
+
+# enable uss and mount the volume
+TEST $CLI volume set $V0 features.uss enable
+TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0
+
+# create 10 snapshots and check if all are being reflected
+# in the USS world
+for i in {1..10}; do $CLI snapshot create snap$i $V0; done
+EXPECT 10 uss_count_snap_displayed $M0
+
+# snapshots should not be displayed after deactivation
+for i in {1..10}; do $CLI snapshot deactivate snap$i --mode=script; done
+EXPECT 0 uss_count_snap_displayed $M0
+
+# activate all the snapshots and check if all the activated snapshots
+# are displayed again
+for i in {1..10}; do $CLI snapshot activate snap$i --mode=script; done
+EXPECT 10 uss_count_snap_displayed $M0
+
+cleanup;
+
diff --git a/tests/snapshot.rc b/tests/snapshot.rc
index cddbb49584a..6ca276d194b 100755
--- a/tests/snapshot.rc
+++ b/tests/snapshot.rc
@@ -391,6 +391,12 @@ function check_if_snapd_exist() {
if [ -n "$pid" ]; then echo "Y"; else echo "N"; fi
}
+# returns number of snapshot being displayed in ".snaps" directory
+function uss_count_snap_displayed() {
+ local path=$1
+ ls $path/.snaps | wc -l
+}
+
case $OSTYPE in
NetBSD)
echo "Skip test on LVM which is not available on NetBSD" >&2