diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_check_volume_status.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/test_check_volume_status.py b/tests/test_check_volume_status.py index 6b0be67..68c5a9b 100644 --- a/tests/test_check_volume_status.py +++ b/tests/test_check_volume_status.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +import json import mock from testrunner import PluginsTestCase as TestCaseBase @@ -41,6 +42,9 @@ class TestCheckVolumeStatus(TestCaseBase): args = ArgParseMock('test-cluster', 'test-vol') exitStatusCode, exitStatusMsg = (check_volume_status .getVolumeStatus(args)) + print exitStatusMsg + print _expectedVolume() + assert exitStatusMsg == ("OK: Volume is up \n%s" % _expectedVolume()) assert exitStatusCode == utils.PluginStatusCode.OK # Method to test volume status when no volume @@ -70,9 +74,29 @@ def _getVolume(): 'uuid': '0000-0000-0000-1111', 'volumeName': 'test-vol', 'volumeStatus': 'ONLINE', - 'volumeType': 'DISTRIBUTED'}} + 'volumeType': 'DISTRIBUTED'}, + 'test-vol2': {'brickCount': 2, + 'bricks': ['server1:/path1', 'server2:/path2'], + 'options': {'option': 'val'}, + 'transportType': ['tcp'], + 'uuid': '0000-0000-0000-1111', + 'volumeName': 'test-vol', + 'volumeStatus': 'ONLINE', + 'volumeType': 'DISTRIBUTED'}} return vol +def _expectedVolume(): + vol = {'test-vol': {'brickCount': 2, + 'bricks': ['server1:/path1', 'server2:/path2'], + 'options': {}, + 'transportType': ['tcp'], + 'uuid': '0000-0000-0000-1111', + 'volumeName': 'test-vol', + 'volumeStatus': 'ONLINE', + 'volumeType': 'DISTRIBUTED'}} + return json.dumps(vol) + + def _getEmptyVolume(): return {} |