From e9c90da38e1b6fb7fc4e0d5d1e987c510d1c17d6 Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Tue, 13 Jan 2015 11:40:03 +0530 Subject: tests: move all snapshot test cases from glusterd to snapshot component Change-Id: Id04037a38e80fe9b400678cfe6bc731cdefae834 BUG: 1178685 Signed-off-by: Atin Mukherjee Reviewed-on: http://review.gluster.org/9437 Reviewed-by: Niels de Vos Tested-by: Gluster Build System --- tests/bugs/glusterd/bug-1087203.t | 103 --------------------- tests/bugs/glusterd/bug-1090042.t | 30 ------ tests/bugs/glusterd/bug-1109770.t | 65 ------------- tests/bugs/glusterd/bug-1109889.t | 74 --------------- tests/bugs/glusterd/bug-1112559.t | 61 ------------ tests/bugs/glusterd/bug-1112613.t | 49 ---------- tests/bugs/glusterd/bug-1113975.t | 38 -------- ...hot-and-features-encryption-option-validation.t | 33 ------- tests/bugs/snapshot/bug-1087203.t | 103 +++++++++++++++++++++ tests/bugs/snapshot/bug-1090042.t | 30 ++++++ tests/bugs/snapshot/bug-1109770.t | 65 +++++++++++++ tests/bugs/snapshot/bug-1109889.t | 74 +++++++++++++++ tests/bugs/snapshot/bug-1112559.t | 61 ++++++++++++ tests/bugs/snapshot/bug-1112613.t | 49 ++++++++++ tests/bugs/snapshot/bug-1113975.t | 38 ++++++++ ...hot-and-features-encryption-option-validation.t | 33 +++++++ 16 files changed, 453 insertions(+), 453 deletions(-) delete mode 100644 tests/bugs/glusterd/bug-1087203.t delete mode 100755 tests/bugs/glusterd/bug-1090042.t delete mode 100644 tests/bugs/glusterd/bug-1109770.t delete mode 100644 tests/bugs/glusterd/bug-1109889.t delete mode 100755 tests/bugs/glusterd/bug-1112559.t delete mode 100644 tests/bugs/glusterd/bug-1112613.t delete mode 100644 tests/bugs/glusterd/bug-1113975.t delete mode 100644 tests/bugs/glusterd/bug-1140162-file-snapshot-and-features-encryption-option-validation.t create mode 100644 tests/bugs/snapshot/bug-1087203.t create mode 100755 tests/bugs/snapshot/bug-1090042.t create mode 100644 tests/bugs/snapshot/bug-1109770.t create mode 100644 tests/bugs/snapshot/bug-1109889.t create mode 100755 tests/bugs/snapshot/bug-1112559.t create mode 100644 tests/bugs/snapshot/bug-1112613.t create mode 100644 tests/bugs/snapshot/bug-1113975.t create mode 100644 tests/bugs/snapshot/bug-1140162-file-snapshot-and-features-encryption-option-validation.t diff --git a/tests/bugs/glusterd/bug-1087203.t b/tests/bugs/glusterd/bug-1087203.t deleted file mode 100644 index 035be098576..00000000000 --- a/tests/bugs/glusterd/bug-1087203.t +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc -. $(dirname $0)/../../cluster.rc - -function get_volume_info () -{ - local var=$1 - $CLI_1 volume info $V0 | grep "^$var" | sed 's/.*: //' -} - -cleanup; - -TEST verify_lvm_version -TEST launch_cluster 2 -TEST setup_lvm 2 - -TEST $CLI_1 peer probe $H2; -EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count; - -TEST $CLI_1 volume create $V0 $H1:$L1 $H2:$L2 -EXPECT "$V0" get_volume_info 'Volume Name'; -EXPECT 'Created' get_volume_info 'Status'; - -TEST $CLI_1 volume start $V0 -EXPECT 'Started' get_volume_info 'Status'; - - -# Setting system limit -TEST $CLI_1 snapshot config snap-max-hard-limit 100 - -# Volume limit cannot exceed system limit, as limit is set to 100, -# this should fail. -TEST ! $CLI_1 snapshot config $V0 snap-max-hard-limit 101 - -# Following are the invalid cases -TEST ! $CLI_1 snapshot config $V0 snap-max-hard-limit a10 -TEST ! $CLI_1 snapshot config snap-max-hard-limit 10a -TEST ! $CLI_1 snapshot config snap-max-hard-limit 10% -TEST ! $CLI_1 snapshot config snap-max-soft-limit 50%1 -TEST ! $CLI_1 snapshot config snap-max-soft-limit 0111 -TEST ! $CLI_1 snapshot config snap-max-hard-limit OXA -TEST ! $CLI_1 snapshot config snap-max-hard-limit 11.11 -TEST ! $CLI_1 snapshot config snap-max-soft-limit 50% -TEST ! $CLI_1 snapshot config snap-max-hard-limit -100 -TEST ! $CLI_1 snapshot config snap-max-soft-limit -90 - -# Soft limit cannot be assigned to volume -TEST ! $CLI_1 snapshot config $V0 snap-max-soft-limit 10 - -# Valid case -TEST $CLI_1 snapshot config snap-max-soft-limit 50 -TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 10 - -# Validating auto-delete feature -# Make sure auto-delete is disabled by default -EXPECT 'disable' snap_config CLI_1 'auto-delete' - -# Test for invalid value for auto-delete -TEST ! $CLI_1 snapshot config auto-delete test - -TEST $CLI_1 snapshot config snap-max-hard-limit 6 -TEST $CLI_1 snapshot config snap-max-soft-limit 50 - -# Create 4 snapshots -snap_index=1 -snap_count=4 -TEST snap_create CLI_1 $V0 $snap_index $snap_count - -# If auto-delete is disabled then oldest snapshot -# should not be deleted automatically. -EXPECT '4' get_snap_count CLI_1; - -TEST snap_delete CLI_1 $snap_index $snap_count; - -# After all those 4 snaps are deleted, There will not be any snaps present -EXPECT '0' get_snap_count CLI_1; - -TEST $CLI_1 snapshot config auto-delete enable - -# auto-delete is already enabled, Hence expect a failure. -TEST ! $CLI_1 snapshot config auto-delete on - -# Testing other boolean values with auto-delete -TEST $CLI_1 snapshot config auto-delete off -EXPECT 'off' snap_config CLI_1 'auto-delete' - -TEST $CLI_1 snapshot config auto-delete true -EXPECT 'true' snap_config CLI_1 'auto-delete' - -# Try to create 4 snaps again, As auto-delete is enabled -# oldest snap should be deleted and snapcount should be 3 - -TEST snap_create CLI_1 $V0 $snap_index $snap_count; -EXPECT '3' get_snap_count CLI_1; - -TEST $CLI_1 snapshot config auto-delete disable -EXPECT 'disable' snap_config CLI_1 'auto-delete' - -cleanup; - diff --git a/tests/bugs/glusterd/bug-1090042.t b/tests/bugs/glusterd/bug-1090042.t deleted file mode 100755 index b4df8e6cebe..00000000000 --- a/tests/bugs/glusterd/bug-1090042.t +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc - -cleanup; - -TEST init_n_bricks 3; -TEST setup_lvm 3; -TEST glusterd; - -TEST $CLI volume create $V0 replica 3 $H0:$L1 $H0:$L2 $H0:$L3; -TEST $CLI volume start $V0; - -TEST kill_brick $V0 $H0 $L1; - -#Normal snap create should fail -TEST ! $CLI snapshot create ${V0}_snap1 $V0; -TEST ! snapshot_exists 0 ${V0}_snap1; - -#Force snap create should succeed -TEST $CLI snapshot create ${V0}_snap1 $V0 force; -TEST snapshot_exists 0 ${V0}_snap1; - -#Delete the created snap -TEST $CLI snapshot delete ${V0}_snap1; -TEST ! snapshot_exists 0 ${V0}_snap1; - -cleanup; diff --git a/tests/bugs/glusterd/bug-1109770.t b/tests/bugs/glusterd/bug-1109770.t deleted file mode 100644 index eca4969f2e3..00000000000 --- a/tests/bugs/glusterd/bug-1109770.t +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc -. $(dirname $0)/../../fileio.rc -. $(dirname $0)/../../nfs.rc - -cleanup; - -TEST init_n_bricks 3; -TEST setup_lvm 3; - -TEST glusterd; - -TEST pidof glusterd; - -TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; - -TEST $CLI volume start $V0; - -TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; - -for i in {1..10} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot create snap1 $V0; - -for i in {11..20} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot create snap2 $V0; - -mkdir $M0/dir1; -mkdir $M0/dir2; - -for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done -for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done - -TEST $CLI snapshot create snap3 $V0; - -for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done -for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done - -TEST $CLI snapshot create snap4 $V0; - -TEST $CLI volume set $V0 features.uss enable; - -EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist - -TEST $CLI volume set $V0 features.uss disable; - -SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); - -TEST ! [ $SNAPD_PID -gt 0 ]; - -TEST $CLI volume set $V0 features.uss enable; - -EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist - -TEST $CLI volume stop $V0; - -SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); - -TEST ! [ $SNAPD_PID -gt 0 ]; - -cleanup ; diff --git a/tests/bugs/glusterd/bug-1109889.t b/tests/bugs/glusterd/bug-1109889.t deleted file mode 100644 index eac5ac17f5b..00000000000 --- a/tests/bugs/glusterd/bug-1109889.t +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc -. $(dirname $0)/../../fileio.rc -. $(dirname $0)/../../nfs.rc - -cleanup; - -TEST init_n_bricks 3; -TEST setup_lvm 3; - -TEST glusterd; - -TEST pidof glusterd; - -TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; - -TEST $CLI volume start $V0; - -TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; - -MOUNT_PID=`ps ax |grep "glusterfs --volfile-sever $H0 --volfile-id=$V0 $M0" | grep -v grep | awk '{print $1}' | head -1` - -for i in {1..10} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot config activate-on-create enable - -TEST $CLI snapshot create snap1 $V0; - -for i in {11..20} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot create snap2 $V0; - -mkdir $M0/dir1; -mkdir $M0/dir2; - -for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done -for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done - -TEST $CLI snapshot create snap3 $V0; - -for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done -for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done - -TEST $CLI snapshot create snap4 $V0; - -TEST $CLI volume set $V0 features.uss enable; - -#let snapd get started properly and client connect to snapd -EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" snap_client_connected_status $V0 - -SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); - -TEST [ $SNAPD_PID -gt 0 ]; - -TEST stat $M0/.snaps; - -kill -KILL $SNAPD_PID; - -# let snapd die properly -EXPECT_WITHIN $CHILD_UP_TIMEOUT "0" snap_client_connected_status $V0 - -TEST ! stat $M0/.snaps; - -TEST $CLI volume start $V0 force; - -# let client get the snapd port from glusterd and connect -EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" snap_client_connected_status $V0 - -TEST stat $M0/.snaps; - -cleanup; diff --git a/tests/bugs/glusterd/bug-1112559.t b/tests/bugs/glusterd/bug-1112559.t deleted file mode 100755 index f318db61b8a..00000000000 --- a/tests/bugs/glusterd/bug-1112559.t +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../cluster.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc - -function check_peers { - $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l -} - -function check_snaps_status { - $CLI_1 snapshot status | grep 'Snap Name : ' | wc -l -} - -function check_snaps_bricks_health { - $CLI_1 snapshot status | grep 'Brick Running : Yes' | wc -l -} - - -SNAP_COMMAND_TIMEOUT=40 -NUMBER_OF_BRICKS=2 - -cleanup; -TEST verify_lvm_version -TEST launch_cluster 3 -TEST setup_lvm 3 - -TEST $CLI_1 peer probe $H2 -EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count - -TEST $CLI_1 volume create $V0 $H1:$L1 $H2:$L2 - -TEST $CLI_1 volume start $V0 - -#Create snapshot and add a peer together -$CLI_1 snapshot create ${V0}_snap1 ${V0} & -PID_1=$! -$CLI_1 peer probe $H3 -wait $PID_1 - -#Snapshot should be created and in the snaplist -TEST snapshot_exists 1 ${V0}_snap1 - -#Not being paranoid! Just checking for the status of the snapshot -#During the testing of the bug the snapshot would list but actually -#not be created.Therefore check for health of the snapshot -EXPECT_WITHIN $SNAP_COMMAND_TIMEOUT 1 check_snaps_status - -#Disabling the checking of snap brick status , Will continue investigation -#on the failure of the snapbrick port bind issue. -#EXPECT_WITHIN $SNAP_COMMAND_TIMEOUT $NUMBER_OF_BRICKS check_snaps_bricks_health - -#check if the peer is added successfully -EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count - -TEST $CLI_1 snapshot delete ${V0}_snap1 - -cleanup; - - diff --git a/tests/bugs/glusterd/bug-1112613.t b/tests/bugs/glusterd/bug-1112613.t deleted file mode 100644 index e566de056bc..00000000000 --- a/tests/bugs/glusterd/bug-1112613.t +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc -. $(dirname $0)/../../cluster.rc - -cleanup; - -V1="patchy2" - -TEST verify_lvm_version; -TEST launch_cluster 2 -TEST setup_lvm 2 - -TEST $CLI_1 peer probe $H2 -EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count - -TEST $CLI_1 volume create $V0 $H1:$L1 -TEST $CLI_1 volume start $V0 -TEST $CLI_1 volume create $V1 $H2:$L2 -TEST $CLI_1 volume start $V1 - -# Create 3 snapshots for volume $V0 -snap_count=3 -snap_index=1 -TEST snap_create CLI_1 $V0 $snap_index $snap_count; - -# Create 3 snapshots for volume $V1 -snap_count=4 -snap_index=11 -TEST snap_create CLI_1 $V1 $snap_index $snap_count; - -EXPECT '3' get_snap_count CLI_1 $V0; -EXPECT '4' get_snap_count CLI_1 $V1; -EXPECT '7' get_snap_count CLI_1 - -TEST $CLI_1 snapshot delete volume $V0 -EXPECT '0' get_snap_count CLI_1 $V0; -EXPECT '4' get_snap_count CLI_1 $V1; -EXPECT '4' get_snap_count CLI_1 - -TEST $CLI_1 snapshot delete all -EXPECT '0' get_snap_count CLI_1 $V0; -EXPECT '0' get_snap_count CLI_1 $V1; -EXPECT '0' get_snap_count CLI_1 - -cleanup; - diff --git a/tests/bugs/glusterd/bug-1113975.t b/tests/bugs/glusterd/bug-1113975.t deleted file mode 100644 index c1b9b1e3e2c..00000000000 --- a/tests/bugs/glusterd/bug-1113975.t +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../snapshot.rc - -cleanup; - -TEST init_n_bricks 3; -TEST setup_lvm 3; - -TEST glusterd; - -TEST pidof glusterd; - -TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; - -TEST $CLI volume start $V0; - -TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; - -for i in {1..10} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot create snap1 $V0; - -for i in {11..20} ; do echo "file" > $M0/file$i ; done - -TEST $CLI snapshot create snap2 $V0; - -TEST $CLI volume stop $V0 - -TEST $CLI snapshot restore snap1; - -TEST $CLI snapshot restore snap2; - -TEST $CLI volume start $V0 - -cleanup ; diff --git a/tests/bugs/glusterd/bug-1140162-file-snapshot-and-features-encryption-option-validation.t b/tests/bugs/glusterd/bug-1140162-file-snapshot-and-features-encryption-option-validation.t deleted file mode 100644 index f91093db4e7..00000000000 --- a/tests/bugs/glusterd/bug-1140162-file-snapshot-and-features-encryption-option-validation.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -## Test case for BZ-1140160 Volume option set and -## command input should validate correctly. - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -cleanup; - -## Start glusterd -TEST glusterd; -TEST pidof glusterd; - -## Lets create and start volume -TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; -TEST $CLI volume start $V0 - -## Set features.file-snapshot and features.encryption option with non-boolean -## value. These options should fail. -TEST ! $CLI volume set $V0 features.file-snapshot abcd -TEST ! $CLI volume set $V0 features.encryption redhat - -## Set other options with valid value. These options should succeed. -TEST $CLI volume set $V0 barrier enable -TEST $CLI volume set $V0 ping-timeout 60 - -## Set features.file-snapshot and features.encryption option with valid boolean -## value. These options should succeed. -TEST $CLI volume set $V0 features.file-snapshot on -TEST $CLI volume set $V0 features.encryption on - -cleanup; diff --git a/tests/bugs/snapshot/bug-1087203.t b/tests/bugs/snapshot/bug-1087203.t new file mode 100644 index 00000000000..035be098576 --- /dev/null +++ b/tests/bugs/snapshot/bug-1087203.t @@ -0,0 +1,103 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../cluster.rc + +function get_volume_info () +{ + local var=$1 + $CLI_1 volume info $V0 | grep "^$var" | sed 's/.*: //' +} + +cleanup; + +TEST verify_lvm_version +TEST launch_cluster 2 +TEST setup_lvm 2 + +TEST $CLI_1 peer probe $H2; +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count; + +TEST $CLI_1 volume create $V0 $H1:$L1 $H2:$L2 +EXPECT "$V0" get_volume_info 'Volume Name'; +EXPECT 'Created' get_volume_info 'Status'; + +TEST $CLI_1 volume start $V0 +EXPECT 'Started' get_volume_info 'Status'; + + +# Setting system limit +TEST $CLI_1 snapshot config snap-max-hard-limit 100 + +# Volume limit cannot exceed system limit, as limit is set to 100, +# this should fail. +TEST ! $CLI_1 snapshot config $V0 snap-max-hard-limit 101 + +# Following are the invalid cases +TEST ! $CLI_1 snapshot config $V0 snap-max-hard-limit a10 +TEST ! $CLI_1 snapshot config snap-max-hard-limit 10a +TEST ! $CLI_1 snapshot config snap-max-hard-limit 10% +TEST ! $CLI_1 snapshot config snap-max-soft-limit 50%1 +TEST ! $CLI_1 snapshot config snap-max-soft-limit 0111 +TEST ! $CLI_1 snapshot config snap-max-hard-limit OXA +TEST ! $CLI_1 snapshot config snap-max-hard-limit 11.11 +TEST ! $CLI_1 snapshot config snap-max-soft-limit 50% +TEST ! $CLI_1 snapshot config snap-max-hard-limit -100 +TEST ! $CLI_1 snapshot config snap-max-soft-limit -90 + +# Soft limit cannot be assigned to volume +TEST ! $CLI_1 snapshot config $V0 snap-max-soft-limit 10 + +# Valid case +TEST $CLI_1 snapshot config snap-max-soft-limit 50 +TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 10 + +# Validating auto-delete feature +# Make sure auto-delete is disabled by default +EXPECT 'disable' snap_config CLI_1 'auto-delete' + +# Test for invalid value for auto-delete +TEST ! $CLI_1 snapshot config auto-delete test + +TEST $CLI_1 snapshot config snap-max-hard-limit 6 +TEST $CLI_1 snapshot config snap-max-soft-limit 50 + +# Create 4 snapshots +snap_index=1 +snap_count=4 +TEST snap_create CLI_1 $V0 $snap_index $snap_count + +# If auto-delete is disabled then oldest snapshot +# should not be deleted automatically. +EXPECT '4' get_snap_count CLI_1; + +TEST snap_delete CLI_1 $snap_index $snap_count; + +# After all those 4 snaps are deleted, There will not be any snaps present +EXPECT '0' get_snap_count CLI_1; + +TEST $CLI_1 snapshot config auto-delete enable + +# auto-delete is already enabled, Hence expect a failure. +TEST ! $CLI_1 snapshot config auto-delete on + +# Testing other boolean values with auto-delete +TEST $CLI_1 snapshot config auto-delete off +EXPECT 'off' snap_config CLI_1 'auto-delete' + +TEST $CLI_1 snapshot config auto-delete true +EXPECT 'true' snap_config CLI_1 'auto-delete' + +# Try to create 4 snaps again, As auto-delete is enabled +# oldest snap should be deleted and snapcount should be 3 + +TEST snap_create CLI_1 $V0 $snap_index $snap_count; +EXPECT '3' get_snap_count CLI_1; + +TEST $CLI_1 snapshot config auto-delete disable +EXPECT 'disable' snap_config CLI_1 'auto-delete' + +cleanup; + diff --git a/tests/bugs/snapshot/bug-1090042.t b/tests/bugs/snapshot/bug-1090042.t new file mode 100755 index 00000000000..b4df8e6cebe --- /dev/null +++ b/tests/bugs/snapshot/bug-1090042.t @@ -0,0 +1,30 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc + +cleanup; + +TEST init_n_bricks 3; +TEST setup_lvm 3; +TEST glusterd; + +TEST $CLI volume create $V0 replica 3 $H0:$L1 $H0:$L2 $H0:$L3; +TEST $CLI volume start $V0; + +TEST kill_brick $V0 $H0 $L1; + +#Normal snap create should fail +TEST ! $CLI snapshot create ${V0}_snap1 $V0; +TEST ! snapshot_exists 0 ${V0}_snap1; + +#Force snap create should succeed +TEST $CLI snapshot create ${V0}_snap1 $V0 force; +TEST snapshot_exists 0 ${V0}_snap1; + +#Delete the created snap +TEST $CLI snapshot delete ${V0}_snap1; +TEST ! snapshot_exists 0 ${V0}_snap1; + +cleanup; diff --git a/tests/bugs/snapshot/bug-1109770.t b/tests/bugs/snapshot/bug-1109770.t new file mode 100644 index 00000000000..eca4969f2e3 --- /dev/null +++ b/tests/bugs/snapshot/bug-1109770.t @@ -0,0 +1,65 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +TEST init_n_bricks 3; +TEST setup_lvm 3; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; + +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +for i in {1..10} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot create snap1 $V0; + +for i in {11..20} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot create snap2 $V0; + +mkdir $M0/dir1; +mkdir $M0/dir2; + +for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done + +TEST $CLI snapshot create snap3 $V0; + +for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done + +TEST $CLI snapshot create snap4 $V0; + +TEST $CLI volume set $V0 features.uss enable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist + +TEST $CLI volume set $V0 features.uss disable; + +SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); + +TEST ! [ $SNAPD_PID -gt 0 ]; + +TEST $CLI volume set $V0 features.uss enable; + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Y' check_if_snapd_exist + +TEST $CLI volume stop $V0; + +SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); + +TEST ! [ $SNAPD_PID -gt 0 ]; + +cleanup ; diff --git a/tests/bugs/snapshot/bug-1109889.t b/tests/bugs/snapshot/bug-1109889.t new file mode 100644 index 00000000000..eac5ac17f5b --- /dev/null +++ b/tests/bugs/snapshot/bug-1109889.t @@ -0,0 +1,74 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +TEST init_n_bricks 3; +TEST setup_lvm 3; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; + +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +MOUNT_PID=`ps ax |grep "glusterfs --volfile-sever $H0 --volfile-id=$V0 $M0" | grep -v grep | awk '{print $1}' | head -1` + +for i in {1..10} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot config activate-on-create enable + +TEST $CLI snapshot create snap1 $V0; + +for i in {11..20} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot create snap2 $V0; + +mkdir $M0/dir1; +mkdir $M0/dir2; + +for i in {1..10} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {1..10} ; do echo "foo" > $M0/dir2/foo$i ; done + +TEST $CLI snapshot create snap3 $V0; + +for i in {11..20} ; do echo "foo" > $M0/dir1/foo$i ; done +for i in {11..20} ; do echo "foo" > $M0/dir2/foo$i ; done + +TEST $CLI snapshot create snap4 $V0; + +TEST $CLI volume set $V0 features.uss enable; + +#let snapd get started properly and client connect to snapd +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" snap_client_connected_status $V0 + +SNAPD_PID=$(ps auxww | grep snapd | grep -v grep | awk '{print $2}'); + +TEST [ $SNAPD_PID -gt 0 ]; + +TEST stat $M0/.snaps; + +kill -KILL $SNAPD_PID; + +# let snapd die properly +EXPECT_WITHIN $CHILD_UP_TIMEOUT "0" snap_client_connected_status $V0 + +TEST ! stat $M0/.snaps; + +TEST $CLI volume start $V0 force; + +# let client get the snapd port from glusterd and connect +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" snap_client_connected_status $V0 + +TEST stat $M0/.snaps; + +cleanup; diff --git a/tests/bugs/snapshot/bug-1112559.t b/tests/bugs/snapshot/bug-1112559.t new file mode 100755 index 00000000000..f318db61b8a --- /dev/null +++ b/tests/bugs/snapshot/bug-1112559.t @@ -0,0 +1,61 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../cluster.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc + +function check_peers { + $CLI_1 peer status | grep 'Peer in Cluster (Connected)' | wc -l +} + +function check_snaps_status { + $CLI_1 snapshot status | grep 'Snap Name : ' | wc -l +} + +function check_snaps_bricks_health { + $CLI_1 snapshot status | grep 'Brick Running : Yes' | wc -l +} + + +SNAP_COMMAND_TIMEOUT=40 +NUMBER_OF_BRICKS=2 + +cleanup; +TEST verify_lvm_version +TEST launch_cluster 3 +TEST setup_lvm 3 + +TEST $CLI_1 peer probe $H2 +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count + +TEST $CLI_1 volume create $V0 $H1:$L1 $H2:$L2 + +TEST $CLI_1 volume start $V0 + +#Create snapshot and add a peer together +$CLI_1 snapshot create ${V0}_snap1 ${V0} & +PID_1=$! +$CLI_1 peer probe $H3 +wait $PID_1 + +#Snapshot should be created and in the snaplist +TEST snapshot_exists 1 ${V0}_snap1 + +#Not being paranoid! Just checking for the status of the snapshot +#During the testing of the bug the snapshot would list but actually +#not be created.Therefore check for health of the snapshot +EXPECT_WITHIN $SNAP_COMMAND_TIMEOUT 1 check_snaps_status + +#Disabling the checking of snap brick status , Will continue investigation +#on the failure of the snapbrick port bind issue. +#EXPECT_WITHIN $SNAP_COMMAND_TIMEOUT $NUMBER_OF_BRICKS check_snaps_bricks_health + +#check if the peer is added successfully +EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count + +TEST $CLI_1 snapshot delete ${V0}_snap1 + +cleanup; + + diff --git a/tests/bugs/snapshot/bug-1112613.t b/tests/bugs/snapshot/bug-1112613.t new file mode 100644 index 00000000000..e566de056bc --- /dev/null +++ b/tests/bugs/snapshot/bug-1112613.t @@ -0,0 +1,49 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc +. $(dirname $0)/../../cluster.rc + +cleanup; + +V1="patchy2" + +TEST verify_lvm_version; +TEST launch_cluster 2 +TEST setup_lvm 2 + +TEST $CLI_1 peer probe $H2 +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count + +TEST $CLI_1 volume create $V0 $H1:$L1 +TEST $CLI_1 volume start $V0 +TEST $CLI_1 volume create $V1 $H2:$L2 +TEST $CLI_1 volume start $V1 + +# Create 3 snapshots for volume $V0 +snap_count=3 +snap_index=1 +TEST snap_create CLI_1 $V0 $snap_index $snap_count; + +# Create 3 snapshots for volume $V1 +snap_count=4 +snap_index=11 +TEST snap_create CLI_1 $V1 $snap_index $snap_count; + +EXPECT '3' get_snap_count CLI_1 $V0; +EXPECT '4' get_snap_count CLI_1 $V1; +EXPECT '7' get_snap_count CLI_1 + +TEST $CLI_1 snapshot delete volume $V0 +EXPECT '0' get_snap_count CLI_1 $V0; +EXPECT '4' get_snap_count CLI_1 $V1; +EXPECT '4' get_snap_count CLI_1 + +TEST $CLI_1 snapshot delete all +EXPECT '0' get_snap_count CLI_1 $V0; +EXPECT '0' get_snap_count CLI_1 $V1; +EXPECT '0' get_snap_count CLI_1 + +cleanup; + diff --git a/tests/bugs/snapshot/bug-1113975.t b/tests/bugs/snapshot/bug-1113975.t new file mode 100644 index 00000000000..c1b9b1e3e2c --- /dev/null +++ b/tests/bugs/snapshot/bug-1113975.t @@ -0,0 +1,38 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../snapshot.rc + +cleanup; + +TEST init_n_bricks 3; +TEST setup_lvm 3; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3; + +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +for i in {1..10} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot create snap1 $V0; + +for i in {11..20} ; do echo "file" > $M0/file$i ; done + +TEST $CLI snapshot create snap2 $V0; + +TEST $CLI volume stop $V0 + +TEST $CLI snapshot restore snap1; + +TEST $CLI snapshot restore snap2; + +TEST $CLI volume start $V0 + +cleanup ; diff --git a/tests/bugs/snapshot/bug-1140162-file-snapshot-and-features-encryption-option-validation.t b/tests/bugs/snapshot/bug-1140162-file-snapshot-and-features-encryption-option-validation.t new file mode 100644 index 00000000000..f91093db4e7 --- /dev/null +++ b/tests/bugs/snapshot/bug-1140162-file-snapshot-and-features-encryption-option-validation.t @@ -0,0 +1,33 @@ +#!/bin/bash + +## Test case for BZ-1140160 Volume option set and +## command input should validate correctly. + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; + +## Lets create and start volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume start $V0 + +## Set features.file-snapshot and features.encryption option with non-boolean +## value. These options should fail. +TEST ! $CLI volume set $V0 features.file-snapshot abcd +TEST ! $CLI volume set $V0 features.encryption redhat + +## Set other options with valid value. These options should succeed. +TEST $CLI volume set $V0 barrier enable +TEST $CLI volume set $V0 ping-timeout 60 + +## Set features.file-snapshot and features.encryption option with valid boolean +## value. These options should succeed. +TEST $CLI volume set $V0 features.file-snapshot on +TEST $CLI volume set $V0 features.encryption on + +cleanup; -- cgit