Merge pull request #50 from guoqiao/migrate-glance

charm_tests/glance: migrate Amulet tests to Zaza
This commit is contained in:
David Ames
2019-09-09 15:33:27 -07:00
committed by GitHub

View File

@@ -67,6 +67,44 @@ class GlanceTest(test_utils.OpenStackBaseTest):
{'image_format': {'disk_formats': ['qcow2']}},
['glance-api'])
def test_900_restart_on_config_change(self):
"""Checking restart happens on config change."""
# Expected default and alternate values
current_value = openstack_utils.get_application_config_option(
'glance', 'debug')
# this is bool, not str
assert type(current_value) == bool
new_value = not current_value
# convert bool to str
current_value = str(current_value)
new_value = str(new_value)
set_default = {'debug': current_value}
set_alternate = {'debug': new_value}
default_entry = {'DEFAULT': {'debug': [current_value]}}
alternate_entry = {'DEFAULT': {'debug': [new_value]}}
# Config file affected by juju set config change
conf_file = '/etc/glance/glance-api.conf'
# Services which are expected to restart upon config change
services = {'glance-api': conf_file}
current_release = openstack_utils.get_os_release()
bionic_stein = openstack_utils.get_os_release('bionic_stein')
if current_release < bionic_stein:
services.update({'glance-registry': conf_file})
# Make config change, check for service restarts
logging.info('changing config: {}'.format(set_alternate))
self.restart_on_changed(
conf_file,
set_default,
set_alternate,
default_entry,
alternate_entry,
services)
def test_901_pause_resume(self):
"""Run pause and resume tests.