4
class AmuletDeployment(object):
5
"""This class provides generic Amulet deployment and test runner
8
def __init__(self, series=None):
9
"""Initialize the deployment environment."""
14
self.d = amulet.Deployment(series=self.series)
16
self.d = amulet.Deployment()
18
def _add_services(self, this_service, other_services):
19
"""Add services to the deployment where this_service is the local charm
20
that we're focused on testing and other_services are the other
21
charms that come from the charm store."""
22
name, units = range(2)
23
self.this_service = this_service[name]
24
self.d.add(this_service[name], units=this_service[units])
26
for svc in other_services:
29
charm='cs:{}/{}'.format(self.series, svc[name]),
32
self.d.add(svc[name], units=svc[units])
34
def _add_relations(self, relations):
35
"""Add all of the relations for the services."""
36
for k, v in relations.iteritems():
39
def _configure_services(self, configs):
40
"""Configure all of the services."""
41
for service, config in configs.iteritems():
42
self.d.configure(service, config)
45
"""Deploy environment and wait for all hooks to finish executing."""
49
except amulet.helpers.TimeoutError:
50
amulet.raise_status(amulet.FAIL, msg="Deployment timed out")
55
"""Run all of the methods that are prefixed with 'test_'."""
56
for test in dir(self):
57
if test.startswith('test_'):