glusterfs
50 строк · 1.4 Кб
1#!/bin/bash
2
3. $(dirname $0)/../../include.rc
4
5cleanup;
6
7TEST glusterd
8TEST pidof glusterd
9TEST $CLI volume info;
10# Distributed volume with a single brick was chosen solely for the ease of
11#implementing the test case (to be precise, for the ease of extracting the port number).
12TEST $CLI volume create $V0 $H0:$B0/brick0;
13
14TEST $CLI volume start $V0;
15
16function port_field()
17{
18local vol=$1;
19local opt=$2;
20if [ $opt -eq '0' ]; then
21$CLI volume status $vol | grep "brick0" | awk '{print $3}';
22else
23$CLI volume status $vol detail | grep "^TCP Port " | awk '{print $4}';
24fi
25}
26
27function xml_port_field()
28{
29local vol=$1;
30local opt=$2;
31$CLI --xml volume status $vol $opt | tr -d '\n' |\
32#Find the first occurrence of the string between <port> and </port>
33sed -rn 's/<port>/&###/;s/<\/port>/###&/;s/^.*###(.*)###.*$/\1/p'
34}
35
36TEST $CLI volume status $V0;
37TEST $CLI volume status $V0 detail;
38TEST $CLI --xml volume status $V0;
39TEST $CLI --xml volume status $V0 detail;
40
41# Kill the brick process. After this, port number for the killed (in this case brick) process must be "N/A".
42kill `cat $GLUSTERD_PIDFILEDIR/vols/$V0/$H0-d-backends-brick0.pid`
43
44EXPECT "N/A" port_field $V0 '0'; # volume status
45EXPECT "N/A" port_field $V0 '1'; # volume status detail
46
47EXPECT "N/A" xml_port_field $V0 '';
48EXPECT "N/A" xml_port_field $V0 'detail';
49
50cleanup;
51