summaryrefslogtreecommitdiffstats
path: root/tests/line-coverage/cli-volume-top-profile-coverage.t
blob: 73b72ff24460f3f1b325890c7290ae1233428a71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash

. $(dirname $0)/../include.rc
. $(dirname $0)/../cluster.rc
. $(dirname $0)/../volume.rc

cleanup

# Creating cluster
TEST launch_cluster 3

# Probing peers
TEST $CLI_1 peer probe $H2
TEST $CLI_1 peer probe $H3
EXPECT_WITHIN $PROBE_TIMEOUT 2 peer_count 3

# Creating a volume and starting it.
TEST $CLI_1 volume create $V0 replica 3 $H1:$B1/$V0 $H2:$B2/$V0 $H3:$B3/$V0
TEST $CLI_1 volume start $V0
EXPECT 'Started' cluster_volinfo_field 1 $V0 'Status';

TEST glusterfs -s $H1 --volfile-id $V0 $M1
TEST touch $M1/file{1..100}

# Testing volume top command with and without xml output
function test_volume_top_cmds () {
    local ret=0
    declare -a top_cmds=("read" "open" "write" "opendir" "readdir")
    for cmd in ${top_cmds[@]}; do
        $CLI_1 volume top $V0 $cmd
        (( ret += $? ))
        $CLI_1 volume top $V0 clear
        (( ret += $? ))
        $CLI_1 volume top $V0 $cmd --xml
        (( ret += $? ))
        $CLI_1 volume top $V0 $cmd brick $H1:$B1/$V0
        (( ret += $? ))
        $CLI_1 volume top $V0 clear brick $H1:$B1/$V0
        (( ret += $? ))
        $CLI_1 volume top $V0 $cmd brick $H1:$B1/$V0 --xml
        (( ret += $? ))
    done
    return $ret
}

# Testing volume profile command with and without xml
function test_volume_profile_cmds () {
    local ret=0
    declare -a profile_cmds=("start" "info" "stop")
    for cmd in ${profile_cmds[@]}; do
        $CLI_1 volume profile $V0 $cmd
        (( ret += $? ))
        $CLI_1 volume profile $V0 $cmd --xml
        (( ret += $? ))
    done
    return $ret
}

TEST test_volume_top_cmds;
TEST test_volume_profile_cmds;

cleanup