From c87affc038ac87a1ad753a484a0d3c5a420ebf64 Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Wed, 21 Feb 2018 07:34:28 -0600 Subject: [PATCH] Sync charm-helpers Also update test helper to stop using a known racy and deprecation-warned helper (service_restarted). Change-Id: I1855da50bc1b8abbb04ae450741a2fd96f10df91 --- charmhelpers/contrib/openstack/amulet/utils.py | 4 ++-- tests/basic_deployment.py | 15 +++++++++++---- .../contrib/openstack/amulet/utils.py | 4 ++-- tox.ini | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/charmhelpers/contrib/openstack/amulet/utils.py b/charmhelpers/contrib/openstack/amulet/utils.py index 87f364d1..d93cff3c 100644 --- a/charmhelpers/contrib/openstack/amulet/utils.py +++ b/charmhelpers/contrib/openstack/amulet/utils.py @@ -92,7 +92,7 @@ class OpenStackAmuletUtils(AmuletUtils): return 'endpoint not found' def validate_v3_endpoint_data(self, endpoints, admin_port, internal_port, - public_port, expected): + public_port, expected, expected_num_eps=3): """Validate keystone v3 endpoint data. Validate the v3 endpoint data which has changed from v2. The @@ -138,7 +138,7 @@ class OpenStackAmuletUtils(AmuletUtils): if ret: return 'unexpected endpoint data - {}'.format(ret) - if len(found) != 3: + if len(found) != expected_num_eps: return 'Unexpected number of endpoints found' def validate_svc_catalog_endpoint_data(self, expected, actual): diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index 57fb464f..91c05866 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -591,17 +591,24 @@ class GlanceBasicDeployment(OpenStackAmuletDeployment): conf_file = '/etc/glance/glance-api.conf' # Services which are expected to restart upon config change - services = ['glance-api', 'glance-registry'] + services = { + 'glance-api': conf_file, + 'glance-registry': 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 = 30 - 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): + 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) diff --git a/tests/charmhelpers/contrib/openstack/amulet/utils.py b/tests/charmhelpers/contrib/openstack/amulet/utils.py index 87f364d1..d93cff3c 100644 --- a/tests/charmhelpers/contrib/openstack/amulet/utils.py +++ b/tests/charmhelpers/contrib/openstack/amulet/utils.py @@ -92,7 +92,7 @@ class OpenStackAmuletUtils(AmuletUtils): return 'endpoint not found' def validate_v3_endpoint_data(self, endpoints, admin_port, internal_port, - public_port, expected): + public_port, expected, expected_num_eps=3): """Validate keystone v3 endpoint data. Validate the v3 endpoint data which has changed from v2. The @@ -138,7 +138,7 @@ class OpenStackAmuletUtils(AmuletUtils): if ret: return 'unexpected endpoint data - {}'.format(ret) - if len(found) != 3: + if len(found) != expected_num_eps: return 'Unexpected number of endpoints found' def validate_svc_catalog_endpoint_data(self, expected, actual): diff --git a/tox.ini b/tox.ini index 6d44f4b9..dae53621 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ skipsdist = True setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 CHARM_DIR={envdir} - AMULET_SETUP_TIMEOUT=2700 + AMULET_SETUP_TIMEOUT=5400 install_command = pip install --allow-unverified python-apt {opts} {packages} commands = ostestr {posargs}