From ade53f83d569ee9d46914af51f62a13e0cc9406d Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Thu, 24 Apr 2014 15:51:21 +0530 Subject: plugins: Added geo-rep status to volume_status Added option to get the geo rep status to check_volume_status plugin Change-Id: I32d2a0240e3888505c54fdce9a3fb731b9300e38 Signed-off-by: Sahina Bose Reviewed-on: http://review.gluster.org/7591 Reviewed-by: Shubhendu Tripathi Reviewed-by: Kanagaraj M --- tests/test_check_volume_status.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/test_check_volume_status.py b/tests/test_check_volume_status.py index 68c5a9b..ce7803e 100644 --- a/tests/test_check_volume_status.py +++ b/tests/test_check_volume_status.py @@ -65,6 +65,21 @@ class TestCheckVolumeStatus(TestCaseBase): .getVolumeQuotaStatus(args)) assert exitStatusCode == utils.PluginStatusCode.WARNING + @mock.patch('glusternagios.glustercli.volumeGeoRepStatus') + def test_checkVolumeGeoRepStatus(self, mock_GeoRepStatus): + mock_GeoRepStatus.return_value = _getGeoRepStatus(glustercli + .GeoRepStatus.FAULTY) + args = ArgParseMock('test-cluster', 'test-vol', 'geo-rep') + exitStatusCode, exitStatusMsg = (check_volume_status + .getVolumeGeoRepStatus(args)) + assert exitStatusCode == utils.PluginStatusCode.CRITICAL + mock_GeoRepStatus.return_value = _getGeoRepStatus(glustercli + .GeoRepStatus + .PARTIAL_FAULTY) + exitStatusCode, exitStatusMsg = (check_volume_status + .getVolumeGeoRepStatus(args)) + assert exitStatusCode == utils.PluginStatusCode.WARNING + def _getVolume(): vol = {'test-vol': {'brickCount': 2, @@ -100,3 +115,8 @@ def _expectedVolume(): def _getEmptyVolume(): return {} + + +def _getGeoRepStatus(status): + return {'test-vol': {'status': status, + 'detail': "rhs3-2.novalocal - faulty;"}} -- cgit