summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/basic/volume-snapshot.t5
-rw-r--r--tests/bugs/bug-1045333.t48
-rwxr-xr-xtests/snapshot.rc20
3 files changed, 65 insertions, 8 deletions
diff --git a/tests/basic/volume-snapshot.t b/tests/basic/volume-snapshot.t
index 2030efc05..bb7dcb458 100755
--- a/tests/basic/volume-snapshot.t
+++ b/tests/basic/volume-snapshot.t
@@ -62,6 +62,11 @@ 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
+TEST mount -t glusterfs $H1:/$V0/snaps/${V0}_snap $M0
+TEST umount -f $M0
+TEST mount -t glusterfs $H2:/$V1/snaps/${V1}_snap $M0
+TEST umount -f $M0
+
#Clean up
delete_snapshots
TEST ! snapshot_exists ${V0}_snap
diff --git a/tests/bugs/bug-1045333.t b/tests/bugs/bug-1045333.t
new file mode 100644
index 000000000..5abdd5558
--- /dev/null
+++ b/tests/bugs/bug-1045333.t
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../snapshot.rc
+
+cleanup;
+TEST glusterd;
+TEST pidof glusterd;
+
+TEST setup_lvm 1
+
+TEST $CLI volume create $V0 $H0:$L1
+TEST $CLI volume start $V0
+
+
+S1="${V0}-snap1" #Create snapshot with name contains hyphen(-)
+S2="-${V0}-snap2" #Create snapshot with name starts with hyphen(-)
+#Create snapshot with a long name
+S3="${V0}_single_gluster_volume_is_accessible_by_multiple_clients_offline_snapshot_is_a_long_name"
+
+TEST $CLI snapshot create $V0 -n $S1
+TEST snapshot_exists $S1
+
+TEST $CLI snapshot create $V0 -n $S2
+TEST snapshot_exists $S2
+
+TEST $CLI snapshot create $V0 -n $S3
+TEST snapshot_exists $S3
+
+
+TEST mount -t glusterfs $H0:/$V0/snaps/$S1 $M0
+TEST umount -f $M0
+
+TEST mount -t glusterfs $H0:/$V0/snaps/$S2 $M0
+TEST umount -f $M0
+
+TEST mount -t glusterfs $H0:/$V0/snaps/$S3 $M0
+TEST umount -f $M0
+
+#Clean up
+TEST $CLI snapshot delete $V0 -s $S1
+TEST $CLI snapshot delete $V0 -s $S2
+TEST $CLI snapshot delete $V0 -s $S3
+
+TEST $CLI volume stop $V0 force
+TEST $CLI volume delete $V0
+
+cleanup;
diff --git a/tests/snapshot.rc b/tests/snapshot.rc
index fa308e599..0be98dc06 100755
--- a/tests/snapshot.rc
+++ b/tests/snapshot.rc
@@ -19,11 +19,15 @@ function init_lvm() {
local b
local i
+ if [ "$B1" = "" ]; then
+ B1=$B0
+ fi
+
for i in `seq 1 $LVM_COUNT`; do
b="B$i"
if [ "${!b}" = "" ]; then
echo "Error: $b not defined."
- echo "Please run launch_cluster before creating lvm"
+ echo "Please run launch_cluster with atleast $LVM_COUNT nodes"
return 1
fi
@@ -91,18 +95,18 @@ function _cleanup_lvm() {
function _cleanup_lvm_again() {
local file
- mount | grep $LVM_PREFIX | awk '{print $3}' | xargs umount -f
+ mount | grep $LVM_PREFIX | awk '{print $3}' | xargs -r umount -f
- /sbin/vgs | grep $LVM_PREFIX | awk '{print $1}' | xargs vgremove -f
+ /sbin/vgs | grep $LVM_PREFIX | awk '{print $1}' | xargs -r vgremove -f
- find $B0 -name "${LVM_PREFIX}_loop" | xargs losetup -d
+ find $B0 -name "${LVM_PREFIX}_loop" | xargs -r losetup -d
- find $B0 -name "${LVM_PREFIX}*" | xargs rm -rf
+ find $B0 -name "${LVM_PREFIX}*" | xargs -r rm -rf
- find /run/gluster/snaps -name "*${LVM_PREFIX}*" | xargs rm -rf
+ find /run/gluster/snaps -name "*${LVM_PREFIX}*" | xargs -r rm -rf
for file in `ls /run/gluster/snaps`; do
- find /run/gluster/snaps/$file -mmin -2 | xargs rm -rf
+ find /run/gluster/snaps/$file -mmin -2 | xargs -r rm -rf
done
}
@@ -168,6 +172,6 @@ function _remove_vhd() {
########################################################
function snapshot_exists() {
local snapname=$1
- $CLI_1 snapshot list | egrep -q "\b$snapname\b"
+ $CLI snapshot list | egrep -q "\s$snapname\b"
return $?
}