From e44d4e135747b04a5e2b7cfac21f9a3343e071db Mon Sep 17 00:00:00 2001 From: GauravKumarGarg Date: Wed, 12 Nov 2014 17:41:33 +0530 Subject: DHT: cluster.min-free-disk option should validate correctly PROBLEM: Previously gluster accepting input value as a percentage which is out of range [0-100] and accepting input value as a size (unit is byte) which is fractional for option cluster.min-free-disk. FIX: Now with this change it will refer to correct validation function and it will accept value that is in range [0-100] for input value as a percentage and unsigned integer value for input as a size (unit in byte) for option cluster.min-free-disk. Change-Id: Iee1962a100542e146276cfc8a4068abddee2bf2d BUG: 1163108 Signed-off-by: Gaurav Kumar Garg Reviewed-on: http://review.gluster.org/9104 Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Reviewed-by: Raghavendra G Reviewed-by: Vijay Bellur --- .../bug-1163108-min-free-disk-option-validation.t | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/bugs/glusterd/bug-1163108-min-free-disk-option-validation.t (limited to 'tests/bugs/glusterd/bug-1163108-min-free-disk-option-validation.t') diff --git a/tests/bugs/glusterd/bug-1163108-min-free-disk-option-validation.t b/tests/bugs/glusterd/bug-1163108-min-free-disk-option-validation.t new file mode 100644 index 0000000000..9fc7ac3b84 --- /dev/null +++ b/tests/bugs/glusterd/bug-1163108-min-free-disk-option-validation.t @@ -0,0 +1,37 @@ +#!/bin/bash + +## Test case for cluster.min-free-disk option validation. + + +. $(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/brick1 $H0:$B0/brick2 +TEST $CLI volume start $V0 + +## Setting invalid value for option cluster.min-free-disk should fail +TEST ! $CLI volume set $V0 min-free-disk "" +TEST ! $CLI volume set $V0 min-free-disk 143.!/12 +TEST ! $CLI volume set $V0 min-free-disk 123% +TEST ! $CLI volume set $V0 min-free-disk 194.34% + +## Setting fractional value as a size (unit is byte) for option +## cluster.min-free-disk should fail +TEST ! $CLI volume set $V0 min-free-disk 199.051 +TEST ! $CLI volume set $V0 min-free-disk 111.999 + +## Setting valid value for option cluster.min-free-disk should pass +TEST $CLI volume set $V0 min-free-disk 12% +TEST $CLI volume set $V0 min-free-disk 56.7% +TEST $CLI volume set $V0 min-free-disk 120 +TEST $CLI volume set $V0 min-free-disk 369.0000 + + +cleanup; -- cgit