summaryrefslogtreecommitdiffstats
path: root/tests/bugs/glusterd/daemon-log-level-option.t
blob: 66e55e3d7581956a28425f1b2adebec783a81016 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash

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

function Info_messages_count() {
        local shd_log=$1
        cat $shd_log | grep " I " | wc -l
}

function Warning_messages_count() {
        local shd_log=$1
        cat $shd_log | grep " W " | wc -l
}

function Debug_messages_count() {
        local shd_log=$1
        cat $shd_log | grep " D " | wc -l
}

function Trace_messages_count() {
        local shd_log=$1
        cat $shd_log | grep " T " | wc -l
}

cleanup;

# Basic checks
TEST glusterd
TEST pidof glusterd
TEST $CLI volume info

# set cluster.daemon-log-level option to DEBUG
TEST $CLI volume set all cluster.daemon-log-level DEBUG

#Create a 3X2 distributed-replicate volume
TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1..6};
TEST $CLI volume start $V0

# log should not have any trace messages
EXPECT 0 Trace_messages_count "/var/log/glusterfs/glustershd.log"

# stop the volume and remove glustershd log
TEST $CLI volume stop $V0
rm -f /var/log/glusterfs/glustershd.log

# set cluster.daemon-log-level option to INFO and start the volume
TEST $CLI volume set all cluster.daemon-log-level INFO
TEST $CLI volume start $V0

# log should not have any debug messages
EXPECT 0 Debug_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any trace messages
EXPECT 0 Trace_messages_count "/var/log/glusterfs/glustershd.log"

# stop the volume and remove glustershd log
TEST $CLI volume stop $V0
rm -f /var/log/glusterfs/glustershd.log

# set cluster.daemon-log-level option to WARNING and start the volume
TEST $CLI volume set all cluster.daemon-log-level WARNING
TEST $CLI volume start $V0

# log should not have any info messages
EXPECT 0 Info_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any debug messages
EXPECT 0 Debug_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any trace messages
EXPECT 0 Trace_messages_count "/var/log/glusterfs/glustershd.log"

# stop the volume and remove glustershd log
TEST $CLI volume stop $V0
rm -f /var/log/glusterfs/glustershd.log

# set cluster.daemon-log-level option to ERROR and start the volume
TEST $CLI volume set all cluster.daemon-log-level ERROR
TEST $CLI volume start $V0

# log should not have any info messages
EXPECT 0 Info_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any warning messages
EXPECT 0 Warning_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any debug messages
EXPECT 0 Debug_messages_count "/var/log/glusterfs/glustershd.log"

# log should not have any trace messages
EXPECT 0 Trace_messages_count "/var/log/glusterfs/glustershd.log"

cleanup