diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2018-07-02 20:48:22 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-07-03 14:29:33 +0000 |
commit | 524c869976c837c2ef13b5ef50020e7769188e4d (patch) | |
tree | 5e8e3e39e2735855861eff7074326926de0afa2c /tests/bugs | |
parent | 362762b35635b6fb5cbd7c394c63c08973ec3993 (diff) |
glusterd: Introduce daemon-log-level cluster wide option
This option, applicable to the node level daemons can be very helpful in
controlling the log level of these services. Please note any daemon
which is started prior to setting the specific value of this option (if
not INFO) will need to go through a restart to have this change into
effect.
Change-Id: I7f6d2620bab2b094c737f5cc816bc093e9c9c4c9
fixes: bz#1597473
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/glusterd/daemon-log-level-option.t | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/tests/bugs/glusterd/daemon-log-level-option.t b/tests/bugs/glusterd/daemon-log-level-option.t new file mode 100644 index 00000000000..66e55e3d758 --- /dev/null +++ b/tests/bugs/glusterd/daemon-log-level-option.t @@ -0,0 +1,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 |