6
class AmuletDeployment(object):
9
This class provides generic Amulet deployment and test runner
13
def __init__(self, series=None):
14
"""Initialize the deployment environment."""
19
self.d = amulet.Deployment(series=self.series)
21
self.d = amulet.Deployment()
23
def _add_services(self, this_service, other_services):
26
Add services to the deployment where this_service is the local charm
27
that we're focused on testing and other_services are the other
28
charms that come from the charm store.
30
name, units = range(2)
32
if this_service[name] != os.path.basename(os.getcwd()):
33
s = this_service[name]
34
msg = "The charm's root directory name needs to be {}".format(s)
35
amulet.raise_status(amulet.FAIL, msg=msg)
37
self.d.add(this_service[name], units=this_service[units])
39
for svc in other_services:
42
charm='cs:{}/{}'.format(self.series, svc[name]),
45
self.d.add(svc[name], units=svc[units])
47
def _add_relations(self, relations):
48
"""Add all of the relations for the services."""
49
for k, v in relations.iteritems():
52
def _configure_services(self, configs):
53
"""Configure all of the services."""
54
for service, config in configs.iteritems():
55
self.d.configure(service, config)
58
"""Deploy environment and wait for all hooks to finish executing."""
61
self.d.sentry.wait(timeout=900)
62
except amulet.helpers.TimeoutError:
63
amulet.raise_status(amulet.FAIL, msg="Deployment timed out")
68
"""Run all of the methods that are prefixed with 'test_'."""
69
for test in dir(self):
70
if test.startswith('test_'):