summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-04-10 15:48:32 +0530
committerBala.FA <barumuga@redhat.com>2014-04-29 10:14:33 +0530
commit86a404d7ce805a25762cd66c310b1ad9e3a2a779 (patch)
treed686e65934000e6f750360b1af6917863b3c3686 /tests
parent96122accad447a7c11ce91678465600c262492a2 (diff)
plugins: Enhanced volume status with quota status
Added an optional parameter to query quota status Added command to nrpe.cfg Change-Id: I9f60ed1a98cb2ca59b799cf9c09e3621b7bd8c0c Signed-off-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/test_check_volume_status.py35
2 files changed, 23 insertions, 13 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5f82370..e8ab026 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@
#
test_modules = \
+ test_check_volume_status.py \
test_cpu.py \
test_cpu_dataFile.py \
test_memory.py \
diff --git a/tests/test_check_volume_status.py b/tests/test_check_volume_status.py
index a18cc1c..6b0be67 100644
--- a/tests/test_check_volume_status.py
+++ b/tests/test_check_volume_status.py
@@ -17,18 +17,20 @@
#
# Refer to the README and COPYING files for full details of the license
#
-import argparse
-
import mock
from testrunner import PluginsTestCase as TestCaseBase
from plugins import check_volume_status
from glusternagios import utils
+from glusternagios import glustercli
+
class ArgParseMock(object):
- def __init__(self, cluster, volume):
- self.cluster = cluster
- self.volume = volume
+ def __init__(self, cluster, volume, type="info"):
+ self.cluster = cluster
+ self.volume = volume
+ self.type = type
+
class TestCheckVolumeStatus(TestCaseBase):
@@ -50,20 +52,27 @@ class TestCheckVolumeStatus(TestCaseBase):
.getVolumeStatus(args))
assert exitStatusCode == utils.PluginStatusCode.CRITICAL
+ @mock.patch('glusternagios.glustercli.volumeQuotaStatus')
+ def test_checkVolumeQuotaStatus(self, mock_volumeQuotaStatus):
+ mock_volumeQuotaStatus.return_value = glustercli.\
+ VolumeQuotaStatus.EXCEEDED
+ args = ArgParseMock('test-cluster', 'test-vol', 'quota')
+ exitStatusCode, exitStatusMsg = (check_volume_status
+ .getVolumeQuotaStatus(args))
+ assert exitStatusCode == utils.PluginStatusCode.WARNING
def _getVolume():
vol = {'test-vol': {'brickCount': 2,
- 'bricks': ['server1:/path1', 'server2:/path2'],
- 'options': {'option':'val'},
- 'transportType': ['tcp'],
- 'uuid': '0000-0000-0000-1111',
- 'volumeName': 'test-vol',
- 'volumeStatus': 'ONLINE',
- 'volumeType': 'DISTRIBUTED'}}
+ '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 _getEmptyVolume():
return {}
-