diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/basic/glusterd/check-cloudsync-ancestry.t | 48 | ||||
-rw-r--r-- | tests/volume.rc | 21 |
2 files changed, 69 insertions, 0 deletions
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/volume.rc b/tests/volume.rc index 1adc5b15c35..620268ccfb9 100644 --- a/tests/volume.rc +++ b/tests/volume.rc @@ -887,3 +887,24 @@ function check_changelog_op { $PYTHON $(dirname $0)/../../utils/changelogparser.py ${clog_path}/CHANGELOG | grep "$op" | wc -l } + +function volgen_check_ancestry { + #Returns Y if ancestor_xl is an ancestor of $child_xl according to the volfile + local volfile="$1" + + local child_xl_type="$2" + local child_xl="$3" + + local ancestor_xl_type="$4" + local ancestor_xl="$5" + + child_linenum=$(awk '/type $child_xl_type\/$child_xl/ {print FNR}' $volfile) + ancestor_linenum=$(awk '/type $ancestor_xl_type\/$ancestor_xl/ {print FNR}' $volfile) + + if [ $child_linenum -lt $ancestor_linenum ]; + then + echo "Y" + else + echo "N" + fi +} |