From 1695ece5d70305b4da03d21c3f721ce6d879e4d4 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Thu, 10 Oct 2019 21:59:59 +0530 Subject: tests: add tests for bz#1758878 updates: bz#1193929 Change-Id: I517fa29e57bde970c2c22ebc2de80fec1509cd2d Signed-off-by: Sanju Rakonde Signed-off-by: Ravishankar N --- tests/basic/glusterd/arbiter-volume.t | 29 --------------- tests/basic/glusterd/volume-brick-count.t | 61 +++++++++++++++++++++++++++++++ tests/basic/volume-snapshot-xml.t | 6 +-- 3 files changed, 62 insertions(+), 34 deletions(-) delete mode 100644 tests/basic/glusterd/arbiter-volume.t create mode 100644 tests/basic/glusterd/volume-brick-count.t (limited to 'tests/basic') diff --git a/tests/basic/glusterd/arbiter-volume.t b/tests/basic/glusterd/arbiter-volume.t deleted file mode 100644 index e9edf046905..00000000000 --- a/tests/basic/glusterd/arbiter-volume.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -# This command tests the volume create command validation for arbiter volumes. - -cleanup; -TEST glusterd -TEST pidof glusterd - -TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 -EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" - -TEST $CLI volume delete $V0 -TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/b{4..9} -EXPECT "2 x \(2 \+ 1\) = 6" volinfo_field $V0 "Number of Bricks" - -TEST $CLI volume delete $V0 - -TEST rm -rf $B0/b{1..3} -TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 -EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" -TEST killall -15 glusterd -TEST glusterd -TEST pidof glusterd -EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" - -#cleanup diff --git a/tests/basic/glusterd/volume-brick-count.t b/tests/basic/glusterd/volume-brick-count.t new file mode 100644 index 00000000000..dc1a5278f4f --- /dev/null +++ b/tests/basic/glusterd/volume-brick-count.t @@ -0,0 +1,61 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +function test_volume_config() +{ + volname=$1 + type_string=$2 + brickCount=$3 + distCount=$4 + replicaCount=$5 + arbiterCount=$6 + disperseCount=$7 + redundancyCount=$8 + + EXPECT "$type_string" volinfo_field $volname "Number of Bricks" + EXPECT "$brickCount" get-xml "volume info $volname" "brickCount" + EXPECT "$distCount" get-xml "volume info $volname" "distCount" + EXPECT "$replicaCount" get-xml "volume info $volname" "replicaCount" + EXPECT "$arbiterCount" get-xml "volume info $volname" "arbiterCount" + EXPECT "$disperseCount" get-xml "volume info $volname" "disperseCount" + EXPECT "$redundancyCount" get-xml "volume info $volname" "redundancyCount" +} + +# This command tests the volume create command and number of bricks for different volume types. +cleanup; +TESTS_EXPECTED_IN_LOOP=56 +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create ${V0}_1 replica 3 arbiter 1 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 +test_volume_config "${V0}_1" "1 x \(2 \+ 1\) = 3" "3" "1" "3" "1" "0" "0" + +TEST $CLI volume create ${V0}_2 replica 3 arbiter 1 $H0:$B0/b{4..9} +test_volume_config "${V0}_2" "2 x \(2 \+ 1\) = 6" "6" "2" "3" "1" "0" "0" + + +TEST $CLI volume create ${V0}_3 replica 3 arbiter 1 $H0:$B0/b{10..12} +test_volume_config "${V0}_3" "1 x \(2 \+ 1\) = 3" "3" "1" "3" "1" "0" "0" +TEST killall -15 glusterd +TEST glusterd +TEST pidof glusterd +test_volume_config "${V0}_3" "1 x \(2 \+ 1\) = 3" "3" "1" "3" "1" "0" "0" + +TEST $CLI volume create ${V0}_4 replica 3 $H0:$B0/b{13..15} +test_volume_config "${V0}_4" "1 x 3 = 3" "3" "1" "3" "0" "0" "0" + +TEST $CLI volume create ${V0}_5 replica 3 $H0:$B0/b{16..21} +test_volume_config "${V0}_5" "2 x 3 = 6" "6" "2" "3" "0" "0" "0" + +TEST $CLI volume create ${V0}_6 disperse 3 redundancy 1 $H0:$B0/b{22..24} +test_volume_config "${V0}_6" "1 x \(2 \+ 1\) = 3" "3" "1" "1" "0" "3" "1" + +TEST $CLI volume create ${V0}_7 disperse 3 redundancy 1 $H0:$B0/b{25..30} +test_volume_config "${V0}_7" "2 x \(2 \+ 1\) = 6" "6" "2" "1" "0" "3" "1" + +TEST $CLI volume create ${V0}_8 $H0:$B0/b{31..33} +test_volume_config "${V0}_8" "3" "3" "3" "1" "0" "0" "0" + +cleanup diff --git a/tests/basic/volume-snapshot-xml.t b/tests/basic/volume-snapshot-xml.t index 3ba25f4ddbb..ff63b54538d 100755 --- a/tests/basic/volume-snapshot-xml.t +++ b/tests/basic/volume-snapshot-xml.t @@ -1,13 +1,9 @@ #!/bin/bash . $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc . $(dirname $0)/../snapshot.rc -function get-xml() -{ - $CLI $1 --xml | xmllint --format - | grep $2 | sed 's/\(<"$2">\|<\/"$2">\)//g' -} - cleanup; TEST verify_lvm_version; TEST glusterd; -- cgit