~james-page/charms/trusty/nova-cloud-controller/worker-config

« back to all changes in this revision

Viewing changes to tests/basic_deployment.py

  • Committer: james.page at ubuntu
  • Date: 2014-10-06 21:03:50 UTC
  • mfrom: (102.4.3 nova-cloud-controller)
  • Revision ID: james.page@ubuntu.com-20141006210350-yaws1hwtv6xszu9n
[coreycb,r=james-page] Fixup amulet tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
class NovaCCBasicDeployment(OpenStackAmuletDeployment):
20
20
    """Amulet tests on a basic nova cloud controller deployment."""
21
21
 
22
 
    def __init__(self, series=None, openstack=None, source=None):
 
22
    def __init__(self, series=None, openstack=None, source=None, stable=False):
23
23
        """Deploy the entire test environment."""
24
 
        super(NovaCCBasicDeployment, self).__init__(series, openstack, source)
 
24
        super(NovaCCBasicDeployment, self).__init__(series, openstack, source, stable)
25
25
        self._add_services()
26
26
        self._add_relations()
27
27
        self._configure_services()
29
29
        self._initialize_tests()
30
30
 
31
31
    def _add_services(self):
32
 
        """Add the service that we're testing, including the number of units,
33
 
           where nova-cloud-controller is local, and the other charms are from
34
 
           the charm store."""
35
 
        this_service = ('nova-cloud-controller', 1)
36
 
        other_services = [('mysql', 1), ('rabbitmq-server', 1),
37
 
                          ('nova-compute', 2), ('keystone', 1), ('glance', 1)]
 
32
        """Add services
 
33
 
 
34
           Add the services that we're testing, where nova-cc is local,
 
35
           and the rest of the service are from lp branches that are
 
36
           compatible with the local charm (e.g. stable or next).
 
37
           """
 
38
        this_service = {'name': 'nova-cloud-controller'}
 
39
        other_services = [{'name': 'mysql'}, {'name': 'rabbitmq-server'},
 
40
                          {'name': 'nova-compute', 'units': 2},
 
41
                          {'name': 'keystone'}, {'name': 'glance'}]
38
42
        super(NovaCCBasicDeployment, self)._add_services(this_service,
39
43
                                                         other_services)
40
44
 
378
382
            message = u.relation_error('glance image-service', ret)
379
383
            amulet.raise_status(amulet.FAIL, msg=message)
380
384
 
381
 
    def test_restart_on_config_change(self):
 
385
    def test_z_restart_on_config_change(self):
382
386
        """Verify that the specified services are restarted when the config
383
 
           is changed."""
 
387
           is changed.
 
388
 
 
389
           Note(coreycb): The method name with the _z_ is a little odd
 
390
           but it forces the test to run last.  It just makes things
 
391
           easier because restarting services requires re-authorization.
 
392
           """
384
393
        # NOTE(coreycb): Skipping failing test on essex until resolved.
385
394
        #                config-flags don't take effect on essex.
386
395
        if self._get_openstack_release() == self.precise_essex:
387
396
            u.log.error("Skipping failing test until resolved")
388
397
            return
389
398
 
 
399
        flags_set = 'quota_cores=20,quota_instances=40,quota_ram=102400'
 
400
        flags_reset = 'quota_cores=10,quota_instances=20,quota_ram=51200'
 
401
 
390
402
        services = ['nova-api-ec2', 'nova-api-os-compute', 'nova-objectstore',
391
403
                    'nova-cert', 'nova-scheduler', 'nova-conductor']
392
 
        self.d.configure('nova-cloud-controller',
393
 
         {'config-flags': 'quota_cores=20,quota_instances=40,quota_ram=102400'})
 
404
        self.d.configure('nova-cloud-controller', {'config-flags': flags_set})
394
405
        pgrep_full = True
395
406
 
396
407
        time = 20
398
409
        for s in services:
399
410
            if not u.service_restarted(self.nova_cc_sentry, s, conf,
400
411
                                       pgrep_full=True, sleep_time=time):
 
412
                self.d.configure('nova-cloud-controller',
 
413
                                 {'config-flags': flags_reset})
401
414
                msg = "service {} didn't restart after config change".format(s)
402
415
                amulet.raise_status(amulet.FAIL, msg=msg)
403
416
            time = 0
404
417
 
 
418
        self.d.configure('nova-cloud-controller', {'config-flags': flags_reset})
 
419
 
405
420
    def test_nova_default_config(self):
406
421
        """Verify the data in the nova config file's default section."""
407
422
        # NOTE(coreycb): Currently no way to test on essex because config file