summaryrefslogtreecommitdiffstats
path: root/tests/basic/volume-snapshot.t
diff options
context:
space:
mode:
authorVijaikumar M <vmallika@redhat.com>2014-01-27 14:05:20 +0530
committerRajesh Joseph <rjoseph@redhat.com>2014-02-04 22:57:45 -0800
commit0e32b7304dac960a09b7d425260172a47f4c762e (patch)
tree8efa6e2e3fd6444098f4f0bf0e004c0b53d46af0 /tests/basic/volume-snapshot.t
parentd382c7a7fdf92047655aa54e07a42d346d1d422a (diff)
snapshot: Framework for testing snapshot
This framework can be used to write functional testcase for snapshot operations Change-Id: I850d0e5021ac6c053d89c58567648e1bff273b19 Signed-off-by: Vijaikumar M <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/6798 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Tested-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'tests/basic/volume-snapshot.t')
-rwxr-xr-xtests/basic/volume-snapshot.t78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/basic/volume-snapshot.t b/tests/basic/volume-snapshot.t
new file mode 100755
index 0000000..2030efc
--- /dev/null
+++ b/tests/basic/volume-snapshot.t
@@ -0,0 +1,78 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../cluster.rc
+. $(dirname $0)/../snapshot.rc
+
+V1="patchy2"
+
+function create_volumes() {
+ $CLI_1 volume create $V0 $H1:$L1 &
+ PID_1=$!
+
+ $CLI_2 volume create $V1 $H2:$L2 $H3:$L3 &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+function create_snapshots() {
+ $CLI_1 snapshot create $V0 -n ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot create $V1 -n ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+
+function delete_snapshots() {
+ $CLI_1 snapshot delete $V0 -s ${V0}_snap &
+ PID_1=$!
+
+ $CLI_1 snapshot delete $V1 -s ${V1}_snap &
+ PID_2=$!
+
+ wait $PID_1 $PID_2
+}
+cleanup;
+
+#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 20 2 peer_count;
+
+create_volumes
+EXPECT 'Created' volinfo_field $V0 'Status';
+EXPECT 'Created' volinfo_field $V1 'Status';
+
+start_volumes 2
+EXPECT 'Started' volinfo_field $V0 'Status';
+EXPECT 'Started' volinfo_field $V1 'Status';
+
+#Snapshot Operations
+create_snapshots
+TEST snapshot_exists ${V0}_snap
+TEST snapshot_exists ${V1}_snap
+
+TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 100
+TEST $CLI_1 snapshot config $V1 snap-max-hard-limit 100
+
+#Clean up
+delete_snapshots
+TEST ! snapshot_exists ${V0}_snap
+TEST ! snapshot_exists ${V1}_snap
+
+stop_force_volumes 2
+EXPECT 'Stopped' volinfo_field $V0 'Status';
+EXPECT 'Stopped' volinfo_field $V1 'Status';
+
+delete_volumes 2
+TEST ! volume_exists $V0
+TEST ! volume_exists $V1
+
+cleanup;