From 9d252a32334a185a717da8990bd6b5e07da97771 Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Thu, 8 May 2014 12:46:51 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/7706 --- tests/test_check_volume_status.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests') 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': [], -- cgit