summaryrefslogtreecommitdiffstats
path: root/tests/bugs/cli/bug-1047416.t
blob: 864301034c9eb0ecaa6fcb54a4642c330eb5d5ab (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
63
64
65
66
67
68
69
70
71
#!/bin/bash

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

cleanup;

function write_to_file {
    dd of=$M0/1 if=/dev/zero bs=1024k count=128 oflag=append 2>&1 >/dev/null
}

TEST glusterd
TEST pidof glusterd
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1
# Increasing the json stats dump time interval, so that it doesn't mess with the test.
TEST $CLI volume set $V0 diagnostics.stats-dump-interval 3600
TEST $CLI volume start $V0
TEST $CLI volume profile $V0 start
TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0

# Clear the profile info uptill now.
TEST $CLI volume profile $V0 info clear

# Verify 'volume profile info' prints both cumulative and incremental stats
write_to_file &
wait
output=$($CLI volume profile $V0 info)
EXPECT 2 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 0 '

# Verify 'volume profile info peek' prints both cumulative and incremental stats
# without clearing incremental stats
write_to_file &
wait
output=$($CLI volume profile $V0 info peek)
EXPECT 2 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 1 '

write_to_file &
wait
output=$($CLI volume profile $V0 info peek)
EXPECT 2 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 1 '

# Verify 'volume profile info incremental peek' prints incremental stats only
# without clearing incremental stats
write_to_file &
wait
output=$($CLI volume profile $V0 info incremental peek)
EXPECT 0 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 1 '

write_to_file &
wait
output=$($CLI volume profile $V0 info incremental peek)
EXPECT 0 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 1 '

# Verify 'volume profile info clear' clears both incremental and cumulative stats
write_to_file &
wait
output=$($CLI volume profile $V0 info clear)
EXPECT 2 cleared_stat_count "$output"

output=$($CLI volume profile $V0 info)
EXPECT 2 cumulative_stat_count "$output"
EXPECT 2 incremental_stat_count "$output" ' 0 '
EXPECT 4 data_read_count "$output" ' 0 '
EXPECT 4 data_written_count "$output" ' 0 '

cleanup;