summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-04-24 15:51:21 +0530
committerSahina Bose <sabose@redhat.com>2014-05-01 22:15:03 -0700
commitade53f83d569ee9d46914af51f62a13e0cc9406d (patch)
tree60ca49f92f464a9c02624bc69cdfd9266da64685 /tests
parent63a7839a3d05494960d4ba15e5fef08157c82887 (diff)
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 <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7591 Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Kanagaraj M <kmayilsa@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_check_volume_status.py20
1 files changed, 20 insertions, 0 deletions
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;"}}