From 00bcf8e80bd65de7a8a102b137d35af3ba2cc3c1 Mon Sep 17 00:00:00 2001 From: Sachin Pandit Date: Thu, 26 Jun 2014 07:51:02 +0530 Subject: cli/snapshot : Dont display the snapshot hard-limit, soft-limit and auto-delete value in gluster volume info. Problem : Even though snap-max-hard-limit, snap-max-soft-limit and auto-delete values were not set explicitly, It was getting showed in the output of gluster volume info. Solution : Check if the value is already present in dictionary (That means, it is set), If value is not present then consider the default value, NOTE : This patch doesn't solve the problem where the values which is set globally are being displayed in gluster volume info Change-Id: I61445b3d2a12eb68c38a19bea53b9051ad028050 BUG: 1113476 Signed-off-by: Sachin Pandit Reviewed-on: http://review.gluster.org/8191 Tested-by: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Avra Sengupta Reviewed-by: Raghavendra Bhat Reviewed-by: Kaushal M --- tests/bugs/bug-1087203.t | 13 +++++++++++-- tests/bugs/bug-1113476.t | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/bug-1113476.t (limited to 'tests') diff --git a/tests/bugs/bug-1087203.t b/tests/bugs/bug-1087203.t index 8926274dac7..585ecf440ac 100644 --- a/tests/bugs/bug-1087203.t +++ b/tests/bugs/bug-1087203.t @@ -96,6 +96,9 @@ TEST $CLI_1 snapshot config $V0 snap-max-hard-limit 10 # Make sure auto-delete is disabled by default EXPECT 'disable' config_validate '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 @@ -113,8 +116,14 @@ EXPECT 'No snapshots present' is_snapshot_present; TEST $CLI_1 snapshot config auto-delete enable # auto-delete is already enabled, Hence expect a failure. -TEST ! $CLI_1 snapshot config auto-delete enable -EXPECT 'enable' config_validate 'auto-delete' +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' + +TEST $CLI_1 snapshot config auto-delete true +EXPECT 'true' config_validate 'auto-delete' # Try to create 4 snaps again, As auto-delete is enabled # oldest snap should be deleted and snapcount should be 3 diff --git a/tests/bugs/bug-1113476.t b/tests/bugs/bug-1113476.t new file mode 100644 index 00000000000..7cb9d908269 --- /dev/null +++ b/tests/bugs/bug-1113476.t @@ -0,0 +1,44 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../snapshot.rc + +function volinfo_validate () +{ + local var=$1 + $CLI volume info $V0 | grep "^$var" | sed 's/.*: //' +} + +cleanup; + +TEST verify_lvm_version +TEST glusterd +TEST pidof glusterd +TEST setup_lvm 1 + +TEST $CLI volume create $V0 $H0:$L1 +TEST $CLI volume start $V0 + +EXPECT '' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config snap-max-hard-limit 100 +EXPECT '100' volinfo_validate 'snap-max-hard-limit' +EXPECT '' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config snap-max-soft-limit 50 +EXPECT '100' volinfo_validate 'snap-max-hard-limit' +EXPECT '50' volinfo_validate 'snap-max-soft-limit' +EXPECT '' volinfo_validate 'auto-delete' + +TEST $CLI snapshot config auto-delete enable +EXPECT '100' volinfo_validate 'snap-max-hard-limit' +EXPECT '50' volinfo_validate 'snap-max-soft-limit' +EXPECT 'enable' volinfo_validate 'auto-delete' + +cleanup; + + -- cgit