[1chb1n, r=thedac] wait for unit status and turn on releases for amulet tests

This commit is contained in:
David Ames 2016-01-21 11:58:50 -08:00
commit 4b4e066154
4 changed files with 17 additions and 13 deletions

0
tests/018-basic-trusty-liberty Normal file → Executable file
View File

0
tests/019-basic-trusty-mitaka Normal file → Executable file
View File

0
tests/020-basic-wily-liberty Normal file → Executable file
View File

View File

@ -2,7 +2,6 @@
import amulet
import os
import time
import yaml
from charmhelpers.contrib.openstack.amulet.deployment import (
@ -35,6 +34,11 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
self._add_relations()
self._configure_services()
self._deploy()
u.log.info('Waiting on extended status checks...')
exclude_services = ['mysql']
self._auto_wait_for_status(exclude_services=exclude_services)
self._initialize_tests()
def _add_services(self):
@ -120,9 +124,6 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
u.log.debug('openstack release str: {}'.format(
self._get_openstack_release_string()))
# Let things settle a bit original moving forward
time.sleep(30)
# Authenticate admin with keystone
self.keystone = u.authenticate_keystone_admin(self.keystone_sentry,
user='admin',
@ -670,22 +671,25 @@ class CinderBasicDeployment(OpenStackAmuletDeployment):
conf_file = '/etc/cinder/cinder.conf'
# Services which are expected to restart upon config change
services = [
'cinder-api',
'cinder-scheduler',
'cinder-volume'
]
services = {
'cinder-api': conf_file,
'cinder-scheduler': conf_file,
'cinder-volume': conf_file
}
# Make config change, check for service restarts
u.log.debug('Making config change on {}...'.format(juju_service))
mtime = u.get_sentry_time(sentry)
self.d.configure(juju_service, set_alternate)
sleep_time = 40
for s in services:
for s, conf_file in services.iteritems():
u.log.debug("Checking that service restarted: {}".format(s))
if not u.service_restarted(sentry, s,
conf_file, sleep_time=sleep_time,
pgrep_full=True):
if not u.validate_service_config_changed(sentry, mtime, s,
conf_file,
retry_count=4,
retry_sleep_time=20,
sleep_time=sleep_time):
self.d.configure(juju_service, set_default)
msg = "service {} didn't restart after config change".format(s)
amulet.raise_status(amulet.FAIL, msg=msg)