summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-05-02 16:49:16 +0530
committerSahina Bose <sabose@redhat.com>2014-05-05 02:38:50 -0700
commit4d66729bfae280e3765f11b34c34617e499ab25e (patch)
tree93160454593090200c04533357ab7d6a333f7175 /tests
parentec287fcc84f8bebb52ccaad63f894689fb79862d (diff)
plugins: Plugin to handle server quorum
Plugin to handle log messages related to server quorum Message is parsed for msgid as the msgid is not correctly populated now Fixed pep8 errors in nscautils and added tests Also changed the service name to remove "Status" -it now reads Volume Quota, for instance Change-Id: I339ed16b3806f853ae3555a998974c47157c95ad Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7648 Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Ramesh N <rnachimu@redhat.com> Reviewed-by: Kanagaraj M <kmayilsa@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_check_gluster_syslog.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/test_check_gluster_syslog.py b/tests/test_check_gluster_syslog.py
index c8c5d6a..bfa6ec1 100644
--- a/tests/test_check_gluster_syslog.py
+++ b/tests/test_check_gluster_syslog.py
@@ -39,8 +39,40 @@ class TestGlusterSyslog(TestCaseBase):
"Usage is above soft limit: 300.0KB used by /test/")
check_gluster_syslog.processMsg(message)
mock_send_to_nsca.assert_called_with("test-cluster",
- "Volume Status Quota - test-vol",
+ "Volume Quota - test-vol",
utils.PluginStatusCode.WARNING,
"QUOTA: Usage is "
"above soft limit: "
"300.0KB used by /test/")
+
+ @mock.patch('plugins.nscautils.getNagiosClusterName')
+ @mock.patch('plugins.nscautils.send_to_nsca_subproc')
+ def test_checkProcessMsgForQuorum(self, mock_send_to_nsca,
+ mock_getNagiosClusterName):
+ mock_getNagiosClusterName.return_value = "test-cluster"
+ message = ("-/DAEMON/CRIT/ETC-GLUSTERFS-GLUSTERD.VOL "
+ "[2014-05-02T12:40:14.562509+00:00] "
+ "[2014-05-02 12:40:14.559662] C [MSGID: 106002] "
+ "[glusterd-utils.c:3376:glusterd_do_volume_quorum_action] "
+ "0-management: Server quorum lost for volume dist. "
+ "Stopping local bricks. ")
+ check_gluster_syslog.processMsg(message)
+ mock_send_to_nsca.assert_called_with("test-cluster",
+ "Cluster - Quorum",
+ utils.PluginStatusCode.CRITICAL,
+ "QUORUM: Server quorum lost "
+ "for volume dist. "
+ "Stopping local bricks. ")
+
+ @mock.patch('plugins.nscautils.getNagiosClusterName')
+ @mock.patch('plugins.nscautils.send_to_nsca_subproc')
+ def test_checkProcessInvalidMsgForQuorum(self, mock_send_to_nsca,
+ mock_getNagiosClusterName):
+ mock_getNagiosClusterName.return_value = "test-cluster"
+ message = ("-/DAEMON/CRIT/ETC-GLUSTERFS-GLUSTERD.VOL "
+ "[2014-05-02T12:40:14.562509+00:00] "
+ "[2014-05-02 12:40:14.559662] C "
+ "[glusterd-utils.c:3376:glusterd_do_volume_quorum_action] "
+ "0-management: Random quorum message ")
+ check_gluster_syslog.processMsg(message)
+ assert not mock_send_to_nsca.called, "send nsca should not be called"