summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-05-08 12:46:51 +0530
committerSahina Bose <sabose@redhat.com>2014-05-08 02:23:59 -0700
commit9d252a32334a185a717da8990bd6b5e07da97771 (patch)
tree6f198f90a9e724aca481a05354be75567ae2bd2a /tests
parent5c7a2558334714e55f59ad8c75debe303c420ba4 (diff)
nagios-plugins: Fixed exit status and message for quota plugin
Changed the passive service check to return warning when soft limit exceeded Also corrected the message- if only soft limit exceeded, the message should not contain any entry for hard limit. Change-Id: Ice693997c769d9029825fcd4aafacc45d1577e23 Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7706
Diffstat (limited to 'tests')
-rw-r--r--tests/test_check_volume_status.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_check_volume_status.py b/tests/test_check_volume_status.py
index ad43587..f916174 100644
--- a/tests/test_check_volume_status.py
+++ b/tests/test_check_volume_status.py
@@ -68,6 +68,11 @@ class TestCheckVolumeStatus(TestCaseBase):
.getVolumeQuotaStatus(args))
assert exitStatusCode == utils.PluginStatusCode.OK
self.assertEqual("QUOTA: OK", exitStatusMsg)
+ mock_volumeQuotaStatus.return_value = _getQuotaStatusSoftLimit()
+ exitStatusCode, exitStatusMsg = (check_volume_status
+ .getVolumeQuotaStatus(args))
+ assert exitStatusCode == utils.PluginStatusCode.WARNING
+ self.assertEqual("QUOTA:soft limit exceeded on dir3", exitStatusMsg)
@mock.patch('glusternagios.glustercli.volumeGeoRepStatus')
def test_checkVolumeGeoRepStatus(self, mock_GeoRepStatus):
@@ -115,6 +120,12 @@ def _getQuotaStatusHardLimit():
'soft_ex_dirs': ['dir3']}
+def _getQuotaStatusSoftLimit():
+ return {'status': 'SOFT_LIMIT_EXCEEDED',
+ 'hard_ex_dirs': [],
+ 'soft_ex_dirs': ['dir3']}
+
+
def _getQuotaStatusOk():
return {'status': 'OK',
'hard_ex_dirs': [],