8
class TestDeployment(object):
10
self.d = amulet.Deployment(series='trusty')
11
f = open('zookeeper.yaml')
13
self.d.load(yaml.safe_load(bun))
14
#self.d.add('hdp-zookeeper', charm='~/development/charms/trusty/hdp-zookeeper', units=3)
16
self.d.setup(timeout=900000)
18
except amulet.helpers.TimeoutError:
19
amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
22
self.zk_unit = self.d.sentry.unit['hdp-zookeeper/0']
26
for test in dir(self):
27
if test.startswith('test_'):
32
def test_zookeeper_service_status(self):
33
o,c= self.zk_unit.run("jps | awk '{print $2}'")
34
if o.find('QuorumPeerMain') == -1:
35
amulet.raise_status(amulet.FAIL, msg="Zookeeper QuorumPeerMain not started")
37
def test_validate_zoo_cfg(self):
38
#verify formation of three zookeeper servers in the quorum
39
zoocfgpath = os.path.join(os.path.sep,'etc', 'zookeeper', 'conf','zoo.cfg')
40
out = self.zk_unit.file_contents(zoocfgpath)
41
lines = out.split("\n")
43
for i in range(0,len(lines)):
44
if str(lines[i]).startswith("server."):
47
amulet.raise_status(amulet.FAIL, msg="Zookeeper- Quorum count is not three")
51
if __name__ == '__main__':
52
runner = TestDeployment()