diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-05-27 10:10:47 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2014-05-28 23:08:18 -0700 |
commit | e4f07c24305719c15b591c0b0b9bcf042e1c1889 (patch) | |
tree | 951b71e709b464eeaa7c11c0b97f32cd02ba182c /tests/test_config_generator.py | |
parent | ce3518471c4853d1a51cff5a913de479b1b496ea (diff) |
autoconfig: refactoring and adding test cases
Refactoring the code to use constants for repeatedly used
strings and add some test case.
Change-Id: I7c88231a51ceea3b1cc94223018ecc704b657512
Bug-Url: https://bugzilla.redhat.com/1099093
Bug-Url: https://bugzilla.redhat.com/1099328
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Reviewed-on: http://review.gluster.org/7883
Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'tests/test_config_generator.py')
-rw-r--r-- | tests/test_config_generator.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tests/test_config_generator.py b/tests/test_config_generator.py index d2bc2a1..aa9db1b 100644 --- a/tests/test_config_generator.py +++ b/tests/test_config_generator.py @@ -17,6 +17,8 @@ # from plugins import config_generator +from plugins.config_generator import GLUSTER_AUTO_CONFIG +from plugins.config_generator import HOST_SERVICES from glusternagios.glustercli import HostStatus from testrunner import PluginsTestCase as TestCaseBase @@ -49,10 +51,10 @@ class TestGlusterNagiosConfManager(TestCaseBase): def _verifyHostServices(self, hostConfig, hostData): for brick in hostData['bricks']: self._checkServiceExists("Brick - %s" % brick['brickpath'], - hostConfig['host_services']) + hostConfig[HOST_SERVICES]) self._checkServiceExists( "Brick Utilization - %s" % brick['brickpath'], - hostConfig['host_services']) + hostConfig[HOST_SERVICES]) def _verifyClusterConfig(self, config, clusterData): self.assertEqual(config['host_name'], clusterData['name']) @@ -69,17 +71,17 @@ class TestGlusterNagiosConfManager(TestCaseBase): def _verifyClusterServices(self, clusterConfig, clusterData): totalServices = 0 - services = clusterConfig['host_services'] + services = clusterConfig[HOST_SERVICES] self._checkServiceExists("Cluster - Quorum", services) - self._checkServiceExists("Cluster Auto Config", services) + self._checkServiceExists(GLUSTER_AUTO_CONFIG, services) self._checkServiceExists("Cluster Utilization", services) totalServices += 3 for volume in clusterData['volumes']: totalServices += self._verifyVolumeServices( - clusterConfig['host_services'], volume) - self.assertEqual(len(clusterConfig['host_services']), totalServices) + clusterConfig[HOST_SERVICES], volume) + self.assertEqual(len(clusterConfig[HOST_SERVICES]), totalServices) def _verifyVolumeServices(self, serviceList, volume): serviceDesc = 'Volume Utilization - %s' % (volume['name']) |