~alexlist/charms/trusty/nova-compute/nonstandard-authkeys-path-unittest

« back to all changes in this revision

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

  • Committer: james.page at ubuntu
  • Date: 2014-10-06 21:57:43 UTC
  • mfrom: (80.1.3 nova-compute)
  • Revision ID: james.page@ubuntu.com-20141006215743-auucleyomgjcjche
[coreycb,r=james-page] Fixup amulet tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
           Add services to the deployment where this_service is the local charm
27
27
           that we're testing and other_services are the other services that
28
 
           are being used in the amulet tests.
 
28
           are being used in the local amulet tests.
29
29
           """
30
 
        name, units, location = range(3)
31
 
 
32
 
        if this_service[name] != os.path.basename(os.getcwd()):
33
 
            s = this_service[name]
 
30
        if this_service['name'] != os.path.basename(os.getcwd()):
 
31
            s = this_service['name']
34
32
            msg = "The charm's root directory name needs to be {}".format(s)
35
33
            amulet.raise_status(amulet.FAIL, msg=msg)
36
34
 
37
 
        self.d.add(this_service[name], units=this_service[units])
 
35
        if 'units' not in this_service:
 
36
            this_service['units'] = 1
 
37
 
 
38
        self.d.add(this_service['name'], units=this_service['units'])
38
39
 
39
40
        for svc in other_services:
40
 
            if len(svc) > 2:
41
 
                branch_location = svc[location]
 
41
            if 'location' in svc:
 
42
                branch_location = svc['location']
42
43
            elif self.series:
43
 
                branch_location = 'cs:{}/{}'.format(self.series, svc[name]),
 
44
                branch_location = 'cs:{}/{}'.format(self.series, svc['name']),
44
45
            else:
45
46
                branch_location = None
46
 
            self.d.add(svc[name], charm=branch_location, units=svc[units])
 
47
 
 
48
            if 'units' not in svc:
 
49
                svc['units'] = 1
 
50
 
 
51
            self.d.add(svc['name'], charm=branch_location, units=svc['units'])
47
52
 
48
53
    def _add_relations(self, relations):
49
54
        """Add all of the relations for the services."""