~hopem/charms/trusty/keystone/lp1499643

« back to all changes in this revision

Viewing changes to tests/basic_deployment.py

  • Committer: james.page at ubuntu
  • Date: 2015-09-09 07:45:33 UTC
  • mfrom: (172.1.3 keystone)
  • Revision ID: james.page@ubuntu.com-20150909074533-151c28nv271kwahs
[1chb1n,r=james-page] Resync helpers and update amulet tests to avoid config-changed restart races.

Show diffs side-by-side

added added

removed removed

Lines of Context:
456
456
        set_default = {'use-syslog': 'False'}
457
457
        set_alternate = {'use-syslog': 'True'}
458
458
 
459
 
        # Config file affected by juju set config change
460
 
        conf_file = '/etc/keystone/keystone.conf'
461
 
 
462
 
        # Services which are expected to restart upon config change
463
 
        services = ['keystone-all']
 
459
        # Services which are expected to restart upon config change,
 
460
        # and corresponding config files affected by the change
 
461
        services = {'keystone-all': '/etc/keystone/keystone.conf'}
464
462
 
465
463
        # Make config change, check for service restarts
466
464
        u.log.debug('Making config change on {}...'.format(juju_service))
 
465
        mtime = u.get_sentry_time(sentry)
467
466
        self.d.configure(juju_service, set_alternate)
468
467
 
469
468
        sleep_time = 30
470
 
        for s in services:
 
469
        for s, conf_file in services.iteritems():
471
470
            u.log.debug("Checking that service restarted: {}".format(s))
472
 
            if not u.service_restarted(sentry, s,
473
 
                                       conf_file, sleep_time=sleep_time):
 
471
            if not u.validate_service_config_changed(sentry, mtime, s,
 
472
                                                     conf_file,
 
473
                                                     sleep_time=sleep_time):
 
474
 
474
475
                self.d.configure(juju_service, set_default)
475
476
                msg = "service {} didn't restart after config change".format(s)
476
477
                amulet.raise_status(amulet.FAIL, msg=msg)
477
 
            sleep_time = 0
478
478
 
479
479
        self.d.configure(juju_service, set_default)
480
480
 
 
481
        u.log.debug('OK')
 
482
 
481
483
    def test_901_pause_resume(self):
482
484
        """Test pause and resume actions."""
483
485
        unit_name = "keystone/0"