diff options
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/bug-1087203.t | 61 | ||||
-rw-r--r-- | tests/bugs/bug-1112613.t | 49 |
2 files changed, 62 insertions, 48 deletions
diff --git a/tests/bugs/bug-1087203.t b/tests/bugs/bug-1087203.t index 585ecf440ac..e41d601fb66 100644 --- a/tests/bugs/bug-1087203.t +++ b/tests/bugs/bug-1087203.t @@ -5,50 +5,12 @@ . $(dirname $0)/../snapshot.rc . $(dirname $0)/../cluster.rc -function config_validate () -{ - local var=$1 - $CLI_1 snapshot config | grep "^$var" | sed 's/.*: //' -} - -function snap_create () -{ - local limit=$1; - local i=0 - while [ $i -lt $limit ] - do - $CLI_1 snapshot create snap$i ${V0} - i=$[$i+1] - done -} - -function snap_delete () -{ - local limit=$1; - local i=0 - while [ $i -lt $limit ] - do - $CLI_1 snapshot delete snap$i - i=$[$i+1] - done -} - -function get_snap_count () -{ - $CLI_1 snapshot list | wc -l -} - function get_volume_info () { local var=$1 $CLI_1 volume info $V0 | grep "^$var" | sed 's/.*: //' } -function is_snapshot_present () -{ - $CLI_1 snapshot list -} - cleanup; TEST verify_lvm_version @@ -94,7 +56,7 @@ 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' config_validate 'auto-delete' +EXPECT 'disable' snap_config CLI_1 'auto-delete' # Test for invalid value for auto-delete TEST ! $CLI_1 snapshot config auto-delete test @@ -103,36 +65,39 @@ TEST $CLI_1 snapshot config snap-max-hard-limit 6 TEST $CLI_1 snapshot config snap-max-soft-limit 50 # Create 4 snapshots -TEST snap_create 4; +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; +EXPECT '4' get_snap_count CLI_1; -TEST snap_delete 4; +TEST snap_delete CLI_1 $snap_index $snap_count; # After all those 4 snaps are deleted, There will not be any snaps present -EXPECT 'No snapshots present' is_snapshot_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' config_validate 'auto-delete' +EXPECT 'off' snap_config CLI_1 'auto-delete' TEST $CLI_1 snapshot config auto-delete true -EXPECT 'true' config_validate 'auto-delete' +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 4; -EXPECT '3' get_snap_count; +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' config_validate 'auto-delete' +EXPECT 'disable' snap_config CLI_1 'auto-delete' cleanup; diff --git a/tests/bugs/bug-1112613.t b/tests/bugs/bug-1112613.t new file mode 100644 index 00000000000..17302eaa427 --- /dev/null +++ b/tests/bugs/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; + |