~openstack-charmers/charms/trusty/neutron-gateway/0mq

« back to all changes in this revision

Viewing changes to tests/charmhelpers/contrib/amulet/deployment.py

  • Committer: james.page at ubuntu
  • Date: 2014-07-31 08:17:28 UTC
  • mfrom: (57.1.1 quantum-gateway)
  • Revision ID: james.page@ubuntu.com-20140731081728-jf9eo43fjiq3bqks
[coreycb,r=james-page] Resync charm-helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
import amulet
2
2
 
 
3
import os
 
4
 
3
5
 
4
6
class AmuletDeployment(object):
5
 
    """This class provides generic Amulet deployment and test runner
6
 
       methods."""
 
7
    """Amulet deployment.
 
8
 
 
9
       This class provides generic Amulet deployment and test runner
 
10
       methods.
 
11
       """
7
12
 
8
13
    def __init__(self, series=None):
9
14
        """Initialize the deployment environment."""
16
21
            self.d = amulet.Deployment()
17
22
 
18
23
    def _add_services(self, this_service, other_services):
19
 
        """Add services to the deployment where this_service is the local charm
 
24
        """Add services.
 
25
 
 
26
           Add services to the deployment where this_service is the local charm
20
27
           that we're focused on testing and other_services are the other
21
 
           charms that come from the charm store."""
 
28
           charms that come from the charm store.
 
29
           """
22
30
        name, units = range(2)
23
 
        self.this_service = this_service[name]
 
31
 
 
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)
 
36
 
24
37
        self.d.add(this_service[name], units=this_service[units])
25
38
 
26
39
        for svc in other_services:
45
58
        """Deploy environment and wait for all hooks to finish executing."""
46
59
        try:
47
60
            self.d.setup()
48
 
            self.d.sentry.wait()
 
61
            self.d.sentry.wait(timeout=900)
49
62
        except amulet.helpers.TimeoutError:
50
63
            amulet.raise_status(amulet.FAIL, msg="Deployment timed out")
51
 
        except:
 
64
        except Exception:
52
65
            raise
53
66
 
54
67
    def run_tests(self):