diff options
Diffstat (limited to 'tests/basic/glusterd')
| -rw-r--r-- | tests/basic/glusterd/arbiter-volume.t | 32 | ||||
| -rw-r--r-- | tests/basic/glusterd/check-cloudsync-ancestry.t | 48 | ||||
| -rw-r--r-- | tests/basic/glusterd/disperse-create.t | 20 | ||||
| -rw-r--r-- | tests/basic/glusterd/heald.t | 55 | ||||
| -rw-r--r-- | tests/basic/glusterd/thin-arbiter-volume-probe.t | 25 | ||||
| -rw-r--r-- | tests/basic/glusterd/thin-arbiter-volume.t | 45 | ||||
| -rw-r--r-- | tests/basic/glusterd/volfile_server_switch.t | 2 | ||||
| -rw-r--r-- | tests/basic/glusterd/volume-brick-count.t | 61 |
8 files changed, 215 insertions, 73 deletions
diff --git a/tests/basic/glusterd/arbiter-volume.t b/tests/basic/glusterd/arbiter-volume.t deleted file mode 100644 index 03f9aca2daf..00000000000 --- a/tests/basic/glusterd/arbiter-volume.t +++ /dev/null @@ -1,32 +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 $CLI volume create $V0 stripe 2 replica 3 arbiter 1 $H0:$B0/b{10..15} -EXPECT "1 x 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/check-cloudsync-ancestry.t b/tests/basic/glusterd/check-cloudsync-ancestry.t new file mode 100644 index 00000000000..ff6ffee8db7 --- /dev/null +++ b/tests/basic/glusterd/check-cloudsync-ancestry.t @@ -0,0 +1,48 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +# When shard and cloudsync xlators enabled on a volume, shard xlator +# should be an ancestor of cloudsync. This testcase is to check this condition. + +cleanup; +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 + +volfile=$(gluster system:: getwd)"/vols/$V0/trusted-$V0.tcp-fuse.vol" + +#Test that both shard and cloudsync are not loaded +EXPECT "N" volgen_volume_exists $volfile $V0-shard features shard +EXPECT "N" volgen_volume_exists $volfile $V0-cloudsync features cloudsync + +#Enable shard and cloudsync in that order and check if volfile is correct +TEST $CLI volume set $V0 shard on +TEST $CLI volume set $V0 cloudsync on + +#Test that both shard and cloudsync are loaded +EXPECT "Y" volgen_volume_exists $volfile $V0-shard features shard +EXPECT "Y" volgen_volume_exists $volfile $V0-cloudsync features cloudsync + +EXPECT "Y" volgen_check_ancestry $volfile features shard features cloudsync + +#Disable shard and cloudsync +TEST $CLI volume set $V0 shard off +TEST $CLI volume set $V0 cloudsync off + +#Test that both shard and cloudsync are not loaded +EXPECT "N" volgen_volume_exists $volfile $V0-shard features shard +EXPECT "N" volgen_volume_exists $volfile $V0-cloudsync features cloudsync + +#Enable cloudsync and shard in that order and check if volfile is correct +TEST $CLI volume set $V0 cloudsync on +TEST $CLI volume set $V0 shard on + +#Test that both shard and cloudsync are loaded +EXPECT "Y" volgen_volume_exists $volfile $V0-shard features shard +EXPECT "Y" volgen_volume_exists $volfile $V0-cloudsync features cloudsync + +EXPECT "Y" volgen_check_ancestry $volfile features shard features cloudsync + +cleanup; diff --git a/tests/basic/glusterd/disperse-create.t b/tests/basic/glusterd/disperse-create.t index e5ce74c12b2..db8a621d48e 100644 --- a/tests/basic/glusterd/disperse-create.t +++ b/tests/basic/glusterd/disperse-create.t @@ -20,6 +20,10 @@ TEST $CLI volume create $V0 disperse 3 redundancy 1 $H0:$B0/b7 $H0:$B0/b8 $H0:$B EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" TEST $CLI volume delete $V0 +TEST $CLI volume create $V0 disperse-data 2 $H0:$B0/b10 $H0:$B0/b11 $H0:$B0/b12 +EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" + +TEST $CLI volume delete $V0 TEST $CLI volume create $V0 redundancy 1 $H0:$B0/b10 $H0:$B0/b11 $H0:$B0/b12 EXPECT "1 x \(2 \+ 1\) = 3" volinfo_field $V0 "Number of Bricks" @@ -48,6 +52,7 @@ TEST ! $CLI volume create $V0 redundancy 1 redundancy 1 $H0:$B0/b20 $H0:$B0/b21 #Minimum counts test TEST ! $CLI volume create $V0 disperse 2 $H0:$B0/b20 $H0:$B0/b22 TEST ! $CLI volume create $V0 disperse-data 1 redundancy 0 $H0:$B0/b20 $H0:$B0/b22 +TEST ! $CLI volume create $V0 disperse 4 disperse-data 4 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b23 $H0:$B0/b24 TEST ! $CLI volume create $V0 redundancy 0 $H0:$B0/b20 $H0:$B0/b22 #Wrong count n != k+m @@ -64,18 +69,5 @@ TEST ! $CLI volume create $V0 redundancy 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0 TEST ! $CLI volume create $V0 replica 2 disperse 4 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 TEST ! $CLI volume create $V0 replica 2 disperse-data 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 $H0:$B0/b23 TEST ! $CLI volume create $V0 replica 2 redundancy 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -#Stripe + Disperse -TEST ! $CLI volume create $V0 disperse 4 stripe 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 disperse-data 2 stripe 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 $H0:$B0/b23 -TEST ! $CLI volume create $V0 redundancy 2 stripe 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 stripe 2 disperse 4 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 stripe 2 disperse-data 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 $H0:$B0/b23 -TEST ! $CLI volume create $V0 stripe 2 redundancy 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -#Stripe + Replicate + Disperse, It is failing with striped-dispersed volume. -TEST ! $CLI volume create $V0 disperse 4 stripe 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 disperse-data 2 stripe 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 $H0:$B0/b23 -TEST ! $CLI volume create $V0 redundancy 2 stripe 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 stripe 2 disperse 4 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 -TEST ! $CLI volume create $V0 stripe 2 disperse-data 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 $H0:$B0/b23 -TEST ! $CLI volume create $V0 stripe 2 redundancy 2 replica 2 $H0:$B0/b20 $H0:$B0/b21 $H0:$B0/b22 + cleanup diff --git a/tests/basic/glusterd/heald.t b/tests/basic/glusterd/heald.t index bdfda8ff0d6..7dae3c3f0fb 100644 --- a/tests/basic/glusterd/heald.t +++ b/tests/basic/glusterd/heald.t @@ -7,70 +7,73 @@ # Covers enable/disable at the moment. Will be enhanced later to include # the other commands as well. +function is_pid_running { + local pid=$1 + num=`ps auxww | grep glustershd | grep $pid | grep -v grep | wc -l` + echo $num +} + cleanup; TEST glusterd TEST pidof glusterd -volfile=$(gluster system:: getwd)"/glustershd/glustershd-server.vol" #Commands should fail when volume doesn't exist TEST ! $CLI volume heal non-existent-volume enable TEST ! $CLI volume heal non-existent-volume disable -# Commands should fail when volume is of distribute/stripe type. # Glustershd shouldn't be running as long as there are no replicate/disperse # volumes TEST $CLI volume create dist $H0:$B0/dist TEST $CLI volume start dist -TEST "[ -z $(get_shd_process_pid)]" +TEST "[ -z $(get_shd_process_pid dist)]" TEST ! $CLI volume heal dist enable TEST ! $CLI volume heal dist disable -TEST $CLI volume create st stripe 3 $H0:$B0/st1 $H0:$B0/st2 $H0:$B0/st3 -TEST $CLI volume start st -TEST "[ -z $(get_shd_process_pid)]" -TEST ! $CLI volume heal st -TEST ! $CLI volume heal st disable # Commands should work on replicate/disperse volume. TEST $CLI volume create r2 replica 2 $H0:$B0/r2_0 $H0:$B0/r2_1 -TEST "[ -z $(get_shd_process_pid)]" +TEST "[ -z $(get_shd_process_pid r2)]" TEST $CLI volume start r2 -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid r2 TEST $CLI volume heal r2 enable EXPECT "enable" volume_option r2 "cluster.self-heal-daemon" -EXPECT "enable" volgen_volume_option $volfile r2-replicate-0 cluster replicate self-heal-daemon -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +volfiler2=$(gluster system:: getwd)"/vols/r2/r2-shd.vol" +EXPECT "enable" volgen_volume_option $volfiler2 r2-replicate-0 cluster replicate self-heal-daemon +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid r2 +pid=$( get_shd_process_pid r2 ) TEST $CLI volume heal r2 disable EXPECT "disable" volume_option r2 "cluster.self-heal-daemon" -EXPECT "disable" volgen_volume_option $volfile r2-replicate-0 cluster replicate self-heal-daemon -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +EXPECT "disable" volgen_volume_option $volfiler2 r2-replicate-0 cluster replicate self-heal-daemon +EXPECT "1" is_pid_running $pid # Commands should work on disperse volume. TEST $CLI volume create ec2 disperse 3 redundancy 1 $H0:$B0/ec2_0 $H0:$B0/ec2_1 $H0:$B0/ec2_2 TEST $CLI volume start ec2 -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid ec2 TEST $CLI volume heal ec2 enable EXPECT "enable" volume_option ec2 "cluster.disperse-self-heal-daemon" -EXPECT "enable" volgen_volume_option $volfile ec2-disperse-0 cluster disperse self-heal-daemon -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +volfileec2=$(gluster system:: getwd)"/vols/ec2/ec2-shd.vol" +EXPECT "enable" volgen_volume_option $volfileec2 ec2-disperse-0 cluster disperse self-heal-daemon +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid ec2 +pid=$(get_shd_process_pid ec2) TEST $CLI volume heal ec2 disable EXPECT "disable" volume_option ec2 "cluster.disperse-self-heal-daemon" -EXPECT "disable" volgen_volume_option $volfile ec2-disperse-0 cluster disperse self-heal-daemon -EXPECT_WITHIN $PROCESS_UP_TIMEOUT "[0-9][0-9]*" get_shd_process_pid +EXPECT "disable" volgen_volume_option $volfileec2 ec2-disperse-0 cluster disperse self-heal-daemon +EXPECT "1" is_pid_running $pid #Check that shd graph is rewritten correctly on volume stop/start -EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse -EXPECT "Y" volgen_volume_exists $volfile r2-replicate-0 cluster replicate +EXPECT "Y" volgen_volume_exists $volfileec2 ec2-disperse-0 cluster disperse + +EXPECT "Y" volgen_volume_exists $volfiler2 r2-replicate-0 cluster replicate TEST $CLI volume stop r2 -EXPECT "Y" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse -EXPECT "N" volgen_volume_exists $volfile r2-replicate-0 cluster replicate +EXPECT "Y" volgen_volume_exists $volfileec2 ec2-disperse-0 cluster disperse TEST $CLI volume stop ec2 # When both the volumes are stopped glustershd volfile is not modified just the # process is stopped -TEST "[ -z $(get_shd_process_pid) ]" +TEST "[ -z $(get_shd_process_pid dist) ]" +TEST "[ -z $(get_shd_process_pid ec2) ]" TEST $CLI volume start r2 -EXPECT "N" volgen_volume_exists $volfile ec2-disperse-0 cluster disperse -EXPECT "Y" volgen_volume_exists $volfile r2-replicate-0 cluster replicate +EXPECT "Y" volgen_volume_exists $volfiler2 r2-replicate-0 cluster replicate TEST $CLI volume set r2 self-heal-daemon on TEST $CLI volume set r2 cluster.self-heal-daemon off diff --git a/tests/basic/glusterd/thin-arbiter-volume-probe.t b/tests/basic/glusterd/thin-arbiter-volume-probe.t new file mode 100644 index 00000000000..acc6943806d --- /dev/null +++ b/tests/basic/glusterd/thin-arbiter-volume-probe.t @@ -0,0 +1,25 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../cluster.rc + +#This tests if the thin-arbiter-count is transferred to the other peer. +function check_peers { + $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l +} + +cleanup; + +TEST launch_cluster 2; +TEST $CLI_1 peer probe $H2; + +EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers + +kill_glusterd 2 +$CLI_1 volume create $V0 replica 2 thin-arbiter 1 $H0:$B0/b{1..3} +TEST $glusterd_2 +EXPECT_WITHIN $PROBE_TIMEOUT 1 check_peers +EXPECT "1 x 2 = 2" volinfo_field_1 $V0 "Number of Bricks" +EXPECT "1 x 2 = 2" volinfo_field_2 $V0 "Number of Bricks" + +cleanup; diff --git a/tests/basic/glusterd/thin-arbiter-volume.t b/tests/basic/glusterd/thin-arbiter-volume.t new file mode 100644 index 00000000000..4e813890a45 --- /dev/null +++ b/tests/basic/glusterd/thin-arbiter-volume.t @@ -0,0 +1,45 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../ volume.rc +. $(dirname $0)/../../thin-arbiter.rc + +#This command tests the volume create command validation for thin-arbiter volumes. + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 replica 2 thin-arbiter 1 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 +EXPECT "1 x 2 = 2" volinfo_field $V0 "Number of Bricks" +TEST $CLI volume start $V0 + +TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0; + +TEST touch $M0/a.txt +TEST ls $B0/b1/a.txt +TEST ls $B0/b2/a.txt +TEST ! ls $B0/b3/a.txt + +TEST umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +TEST $CLI volume create $V0 replica 2 thin-arbiter 1 $H0:$B0/b{4..8} +EXPECT "2 x 2 = 4" volinfo_field $V0 "Number of Bricks" + +TEST $CLI volume delete $V0 + +TEST rm -rf $B0/b{1..3} + +TEST $CLI volume create $V0 replica 2 thin-arbiter 1 $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3 +EXPECT "1 x 2 = 2" volinfo_field $V0 "Number of Bricks" + +TEST killall -15 glusterd +TEST glusterd +TEST pidof glusterd +EXPECT "1 x 2 = 2" volinfo_field $V0 "Number of Bricks" + +cleanup + diff --git a/tests/basic/glusterd/volfile_server_switch.t b/tests/basic/glusterd/volfile_server_switch.t index 309060919b7..e11cfed509a 100644 --- a/tests/basic/glusterd/volfile_server_switch.t +++ b/tests/basic/glusterd/volfile_server_switch.t @@ -34,7 +34,7 @@ TEST glusterfs --volfile-id=/$V0 --volfile-server=$H1 --volfile-server=$H2 --vol TEST kill_glusterd 1 -TEST $CLI_2 volume set $V0 performance.io-cache off +TEST $CLI_2 volume set $V0 performance.write-behind off # make sure by this time directory will be created # TODO: suggest ideal time to wait 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 |
