From 0608244512f1ab0ba9916ab3da9f0bc57ee234fc Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Mon, 22 Oct 2012 10:18:32 +0530 Subject: cli: Mark port as N/A in volume status when process is not online Change-Id: Ie11c7331e3bc58c0f934f424dde4341cdffb9e2c BUG: 861542 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/4048 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-861542.t | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 tests/bugs/bug-861542.t (limited to 'tests/bugs') diff --git a/tests/bugs/bug-861542.t b/tests/bugs/bug-861542.t new file mode 100755 index 000000000..8aef8146e --- /dev/null +++ b/tests/bugs/bug-861542.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; +# Distributed volume with a single brick was chosen solely for the ease of +#implementing the test case (to be precise, for the ease of extracting the port number). +TEST $CLI volume create $V0 $H0:$B0/brick0; + +TEST $CLI volume start $V0; + +function port_field() +{ + local vol=$1; + local opt=$2; + if [ $opt -eq '0' ]; then + $CLI volume status $vol | grep "brick0" | awk '{print $3}'; + else + $CLI volume status $vol detail | grep "^Port " | awk '{print $3}'; + fi +} + +function xml_port_field() +{ + local vol=$1; + local opt=$2; + $CLI --xml volume status $vol $opt | \ +#Find the first occurrence of the string between and + sed -r 's//&\n/;s/<\/port>/\n&/;s/^.*\n(.*)\n.*$/\1/'| \ + grep -v xml | tr -d '\n'; +} + +TEST $CLI volume status $V0; +TEST $CLI volume status $V0 detail; +TEST $CLI --xml volume status $V0; +TEST $CLI --xml volume status $V0 detail; + +# Kill the brick process. After this, port number for the killed (in this case brick) process must be "N/A". +kill `cat /var/lib/glusterd/vols/$V0/run/$H0-d-backends-brick0.pid` + +EXPECT "N/A" port_field $V0 '0'; # volume status +EXPECT "N/A" port_field $V0 '1'; # volume status detail + +EXPECT "N/A" xml_port_field $V0 ''; +EXPECT "N/A" xml_port_field $V0 'detail'; + +cleanup; -- cgit