summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorM. Mohan Kumar <mohan@in.ibm.com>2012-11-29 21:46:08 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-29 09:40:42 -0800
commit48d749dda368149a8f05ea5c09cab93f58835d0b (patch)
tree4c89f611a5e6c1e7480dc12c1a3499308c462203
parent983d290f7b36fea580ed9337bdc15e8f0f6f5bb3 (diff)
BD Backend: Test Casesv3.4.0qa4
BUG: 805138 Change-Id: I04c1b68cf02d55d1481137fe6bb2386c2ba958f3 Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com> Reviewed-on: http://review.gluster.org/4145 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-xtests/basic/bd.t117
1 files changed, 117 insertions, 0 deletions
diff --git a/tests/basic/bd.t b/tests/basic/bd.t
new file mode 100755
index 000000000..3201b7460
--- /dev/null
+++ b/tests/basic/bd.t
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+
+cleanup;
+
+
+function execute()
+{
+ cmd=$1
+ shift
+ ${cmd} $@ >/dev/null 2>&1
+}
+
+function bd_cleanup()
+{
+ execute vgremove -f ${VG}
+ execute pvremove ${ld}
+ execute losetup -d ${ld}
+ execute rm ${BD_DISK}
+ execute $CLI volume delete ${V0}
+ cleanup
+}
+
+function check()
+{
+ if [ $? -ne 0 ]; then
+ echo prerequsite $@ failed
+ bd_cleanup
+ exit
+ fi
+}
+
+VG=__bd_vg
+SIZE=256 #in MB
+
+## Configure environment needed for BD backend volumes
+## Create a file with configured size and
+## set it as a temporary loop device to create
+## physical volume & VG. These are basic things needed
+## for testing BD xlator if anyone of these steps fail,
+## test script exits
+function configure()
+{
+ GLDIR=`$CLI system:: getwd`
+ BD_DISK=${GLDIR}/bd_disk
+
+ execute truncate -s${SIZE}M ${BD_DISK}
+ check ${BD_DISK} creation
+
+ execute losetup -f
+ check losetup
+ ld=`losetup -f`
+
+ execute losetup ${ld} ${BD_DISK}
+ check losetup ${BD_DISK}
+ execute pvcreate -f ${ld}
+ check pvcreate ${ld}
+ execute vgcreate ${VG} ${ld}
+ check vgcreate ${VG}
+}
+
+function volinfo_field()
+{
+ local vol=$1;
+ local field=$2;
+
+ $CLI volume info $vol | grep "^$field: " | sed 's/.*: //';
+}
+
+TEST glusterd
+TEST pidof glusterd
+configure
+
+TEST $CLI volume create $V0 device vg ${H0}:/${VG}
+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 glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0
+
+## Create file (LV)
+TEST touch $M0/$VG/lv1
+TEST stat /dev/$VG/lv1
+
+TEST rm $M0/$VG/lv1;
+TEST ! stat $M0/$VG/lv1;
+
+TEST touch $M0/$VG/lv1
+TEST truncate -s64M $M0/$VG/lv1
+
+TEST ln $M0/$VG/lv1 $M0/$VG/lv2
+TEST stat /dev/$VG/lv2
+
+rm $M0/$VG/lv1
+rm $M0/$VG/lv2
+
+TEST $CLI bd create $V0:/$VG/lv1 4MB
+TEST stat /dev/$VG/lv1
+
+TEST $CLI bd clone $V0:/$VG/lv1 lv2
+TEST stat /dev/$VG/lv2
+TEST $CLI bd delete $V0:/$VG/lv2
+
+TEST $CLI bd snapshot $V0:/$VG/lv1 lv2 1
+TEST stat /dev/$VG/lv2
+rm $M0/$VG/lv2
+rm $M0/$VG/lv1
+
+TEST umount $M0
+TEST $CLI volume stop ${V0}
+TEST $CLI volume delete ${V0}
+
+bd_cleanup