summaryrefslogtreecommitdiffstats
path: root/tests/test_config_generator.py
diff options
context:
space:
mode:
authorRamesh Nachimuthu <rnachimu@redhat.com>2014-04-22 16:45:57 +0530
committerBala.FA <barumuga@redhat.com>2014-04-29 10:21:37 +0530
commitbee9f1ffe9e1586beda00e96d9e3da6171b3ab89 (patch)
treeb1bd463d9018edbeb9449e31d2fbef771965948a /tests/test_config_generator.py
parent938e318bbfec1900aceea25c2702f234961c0493 (diff)
autoconf: use host name for host config
Discover the host name configured for the gluster node and use the same as host_name in nagios host configuration. Change-Id: Ib9eb8b3f3a1a03d1be28fa2faba44c2fc81fa0cf Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Diffstat (limited to 'tests/test_config_generator.py')
-rw-r--r--tests/test_config_generator.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/test_config_generator.py b/tests/test_config_generator.py
index 891bcbc..6fe62d3 100644
--- a/tests/test_config_generator.py
+++ b/tests/test_config_generator.py
@@ -41,8 +41,8 @@ class TestGlusterNagiosConfManager(TestCaseBase):
clusterData['hosts'][index])
def __verifyHostConfig(self, hostConfig, hostData):
- self.assertEqual(hostConfig['host_name'], hostData['hostip'])
- self.assertEqual(hostConfig['alias'], hostData['hostip'])
+ self.assertEqual(hostConfig['host_name'], hostData['hostname'])
+ self.assertEqual(hostConfig['alias'], hostData['hostname'])
self.assertEqual(hostConfig['address'], hostData['hostip'])
self.assertEqual(hostConfig['use'], 'gluster-host')
@@ -50,23 +50,28 @@ class TestGlusterNagiosConfManager(TestCaseBase):
self.assertEqual(config['host_name'], clusterData['name'])
self.assertEqual(config['alias'], clusterData['name'])
self.assertEqual(config['address'], clusterData['name'])
- self.assertEqual(config['check_command'], "")
+ self.assertEqual(config.get('check_command'), None)
self.assertEqual(config['use'], 'gluster-cluster')
- def createBricks(self, count, volume):
+ def createBricks(self, count, volume, hostip):
bricks = []
for number in range(count):
brickDir = "/mnt/Brick-%s" % (number + 1)
bricks.append({'brickpath': brickDir,
- 'volumeName': volume})
+ 'volumeName': volume,
+ 'hostip': hostip})
return bricks
def __createDummyCluster(self):
cluster = {'name': 'Test-Cluster', 'hosts': [], 'volumes': []}
cluster['hosts'].append({'hostip': '10.70.43.1',
- 'bricks': self.createBricks(1, "Volume1")})
+ 'hostname': 'host-1',
+ 'bricks': self.createBricks(1, "Volume1",
+ '10.70.43.1')})
cluster['hosts'].append({'hostip': '10.70.43.2',
- 'bricks': self.createBricks(2, "Volume1")})
+ 'hostname': 'host-2',
+ 'bricks': self.createBricks(2, "Volume1",
+ '10.70.43.2')})
cluster['volumes'].append({'name': 'Volume1', "type": "T"})
return cluster