summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/test_check_gluster_syslog.py46
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e8ab026..a540f11 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@
#
test_modules = \
+ test_check_gluster_syslog.py \
test_check_volume_status.py \
test_cpu.py \
test_cpu_dataFile.py \
diff --git a/tests/test_check_gluster_syslog.py b/tests/test_check_gluster_syslog.py
new file mode 100644
index 0000000..a6dce45
--- /dev/null
+++ b/tests/test_check_gluster_syslog.py
@@ -0,0 +1,46 @@
+#
+# Copyright 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+import mock
+
+from testrunner import PluginsTestCase as TestCaseBase
+from plugins import check_gluster_syslog
+from glusternagios import utils
+
+
+class TestGlusterSyslog(TestCaseBase):
+
+ # Method to test volume perf data when no matching host method
+ @mock.patch('plugins.nscautils.getNagiosClusterName')
+ @mock.patch('plugins.nscautils.send_to_nsca')
+ def test_checkProcessMsg(self, mock_send_to_nsca,
+ mock_getNagiosClusterName):
+ mock_getNagiosClusterName.return_value = "test-cluster"
+ message = ("-/USER/CRIT/GLUSTERFSD [2014-04-06T21:45:33.378443+05:30] "
+ "glusterfsd: [2014-04-06 15:46:59.390038] "
+ "A [quota.c:3670:quota_log_usage] 0-test-vol-quota:"
+ "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",
+ utils.PluginStatusCode.WARNING,
+ "QUOTA: Usage is "
+ "above soft limit: "
+ "300.0KB used by /test/")