diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2012-11-23 22:19:32 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-23 23:27:33 -0800 |
commit | 016480eb8221a403e5224653e57c401fcb61acc0 (patch) | |
tree | fa66b54238279702d94dbd81e5e4e90eccf8965d /tests | |
parent | 7c23a94516c5dd21536c259f323a3cc113fdfa0d (diff) |
tests: Add volume utils in a new file
Change-Id: Ie78d24ca466d4bddc5c0727ed8ed51707e1f2a34
BUG: 839595
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/4228
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/basic/volume.t | 18 | ||||
-rw-r--r-- | tests/volume.rc | 22 |
2 files changed, 23 insertions, 17 deletions
diff --git a/tests/basic/volume.t b/tests/basic/volume.t index de3f001e0..8491164ce 100755 --- a/tests/basic/volume.t +++ b/tests/basic/volume.t @@ -1,6 +1,7 @@ #!/bin/bash . $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc cleanup; @@ -11,23 +12,6 @@ TEST $CLI volume info; TEST $CLI volume create $V0 replica 2 stripe 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; -function volinfo_field() -{ - local vol=$1; - local field=$2; - - $CLI volume info $vol | grep "^$field: " | sed 's/.*: //'; -} - - -function brick_count() -{ - local vol=$1; - - $CLI volume info $vol | egrep "^Brick[0-9]+: " | wc -l; -} - - EXPECT "$V0" volinfo_field $V0 'Volume Name'; EXPECT 'Created' volinfo_field $V0 'Status'; EXPECT '8' brick_count $V0 diff --git a/tests/volume.rc b/tests/volume.rc new file mode 100644 index 000000000..55c96b3ad --- /dev/null +++ b/tests/volume.rc @@ -0,0 +1,22 @@ +function volinfo_field() +{ + local vol=$1; + local field=$2; + + $CLI volume info $vol | grep "^$field: " | sed 's/.*: //'; +} + + +function brick_count() +{ + local vol=$1; + + $CLI volume info $vol | egrep "^Brick[0-9]+: " | wc -l; +} + +function volume_option() +{ + local vol=$1 + local key=$2 + $CLI volume info $vol | egrep "^$key: " | cut -f2 -d' '; +} |