diff options
author | Vijaikumar M <vmallika@redhat.com> | 2014-01-27 14:05:20 +0530 |
---|---|---|
committer | Rajesh Joseph <rjoseph@redhat.com> | 2014-02-04 22:57:45 -0800 |
commit | 0e32b7304dac960a09b7d425260172a47f4c762e (patch) | |
tree | 8efa6e2e3fd6444098f4f0bf0e004c0b53d46af0 /tests/volume.rc | |
parent | d382c7a7fdf92047655aa54e07a42d346d1d422a (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/volume.rc')
-rw-r--r-- | tests/volume.rc | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/volume.rc b/tests/volume.rc index 987122420..171f8d709 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -272,3 +272,54 @@ function get_backend_paths { getfattr -m . -n trusted.glusterfs.pathinfo $path | tr ' ' '\n' | sed -n 's/<POSIX.*:.*:\(.*\)>.*/\1/p' } + +function do_volume_operations() { + local operation=$1 + local count=$2 + local force=$3 + + local pids=() + local cli + local v + + for i in `seq 1 $count`; do + cli="CLI_$i" + v="V`expr $i - 1`" + ${!cli} volume $operation ${!v} $force & + pids[$i]=$! + done + + for i in `seq 1 $count`; do + wait ${pids[$i]} + done +} + +function start_volumes() { + do_volume_operations start $1 +} + +function stop_volumes() { + do_volume_operations stop $1 +} + +function start_force_volumes() { + do_volume_operations start $1 force +} + +function stop_force_volumes() { + do_volume_operations stop $1 force +} + +function delete_volumes() { + do_volume_operations delete $1 +} + +function volume_exists() { + local volname=$1 + $CLI volume info $volname 2>&1 | grep -q 'does not exist' + if [ $? -eq 0 ]; then + return 1 + else + return 0 + fi +} |