From 274b644c95c8f9d5c6ffc0514baf35c33b8335f1 Mon Sep 17 00:00:00 2001 From: Liam Young Date: Fri, 20 Sep 2019 19:09:02 +0100 Subject: [PATCH] First cut --- zaza/openstack/charm_tests/aodh/.tests.py.swp | Bin 0 -> 16384 bytes zaza/openstack/charm_tests/aodh/__init__.py | 15 +++ zaza/openstack/charm_tests/aodh/setup.py | 22 ++++ zaza/openstack/charm_tests/aodh/tests.py | 101 ++++++++++++++++++ zaza/openstack/configure/telemetry.py | 31 ++++++ 5 files changed, 169 insertions(+) create mode 100644 zaza/openstack/charm_tests/aodh/.tests.py.swp create mode 100644 zaza/openstack/charm_tests/aodh/__init__.py create mode 100644 zaza/openstack/charm_tests/aodh/setup.py create mode 100644 zaza/openstack/charm_tests/aodh/tests.py create mode 100644 zaza/openstack/configure/telemetry.py diff --git a/zaza/openstack/charm_tests/aodh/.tests.py.swp b/zaza/openstack/charm_tests/aodh/.tests.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..431d6bca4e2bc867994a800908f7a9d92ed31557 GIT binary patch literal 16384 zcmeHN&5t8T6)yq_A-l_G5L}Qd_Q9TLY|qSIHWMvc@9ZpCOlHv7vq^|nR=HiaE7R_7 zx~j)JiI&f-IKc%F2au3}gnuE2067uhg5ZGQmogBwYfos)yfn6V;?;#>)n-Oz%k$$a11yG90QI4$ADwNG4OxSfQcSrU&bgO z%0}vC=l7gBzc;(j+sQNa*{wS{1{?#90mp!2z%k$$a11yG90QI4$ADwNG4MagfEY4H z&+-@O!5;tr=g00~?Js=ztmG2l;+pdR=U za0B=h@DbqchZ%bv_!jU@pa(n&tO4)7kFnnZuLC~>UIC7P8gL#s2mA#uQGNmZ9MHfQ zfPLUm;7#!VJ>V2L2KIn;fc)|Yyo~u>{z7JD4Dq`hTKc1=mhp-5q+Vxvi)E_0j&oA@q!q>8>mblq2?v@(&;-qY=MyY+V^rg^} zfBG^Xs4!4oUmK}{Qq3(HDB<@5IWu8^E{jh{`iW7#ZjPnthq|BXsn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ji=^!)#IJkS3Wpyz))ZrbCI zS=nnize;uPa11yG90QI4$ADwNG2j?*3^)cH1C9a5fMejl%|QOzlFr$SrKSo-VZA~x f&Fs4z`)?xN!{D#jO8LSs7cBpey= self.xenial_ocata: + services = [ + 'apache2', + 'aodh-evaluator: AlarmEvaluationService worker(0)', + 'aodh-notifier: AlarmNotifierService worker(0)', + ('aodh-listener: EventAlarmEvaluationService' + ' worker(0)')] + elif self.release >= self.xenial_newton: + services = [ + ('/usr/bin/python /usr/bin/aodh-api --port 8032 -- ' + '--config-file=/etc/aodh/aodh.conf ' + '--log-file=/var/log/aodh/aodh-api.log'). + 'aodh-evaluator - AlarmEvaluationService(0)', + 'aodh-notifier - AlarmNotifierService(0)', + 'aodh-listener - EventAlarmEvaluationService(0)'] + else: + services = [ + 'aodh-api', + 'aodh-evaluator', + 'aodh-notifier', + 'aodh-listener'] + return services + + def test_900_restart_on_config_change(self): + """Checking restart happens on config change. + + Change disk format and assert then change propagates to the correct + file and that services are restarted as a result + """ + # Expected default and alternate values + set_default = {'debug': 'False'} + set_alternate = {'debug': 'True'} + + # Config file affected by juju set config change + conf_file = '/etc/aodh/aodh.conf' + + # Make config change, check for service restarts + self.restart_on_changed( + conf_file, + set_default, + set_alternate, + {'DEFAULT': {'debug': ['False']}}, + {'DEFAULT': {'debug': ['True']}}, + self.services) + + def test_901_pause_resume(self): + """Run pause and resume tests. + + Pause service and check services are stopped then resume and check + they are started + """ + xenial_ocata = openstack_utils.get_os_release('xenial_ocata') + xenial_newton = openstack_utils.get_os_release('xenial_newton') + if self.release >= bionic_stein: + pgrep_full = True + else: + pgrep_full = False + with self.pause_resume( + self.services, + pgrep_full=pgrep_full): + logging.info("Testing pause resume") diff --git a/zaza/openstack/configure/telemetry.py b/zaza/openstack/configure/telemetry.py new file mode 100644 index 0000000..54061b1 --- /dev/null +++ b/zaza/openstack/configure/telemetry.py @@ -0,0 +1,31 @@ +# Copyright 2019 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Configure and manage masakari. + +Functions for managing masakari resources and simulating compute node loss +and recovery. +""" + +import logging + +import zaza.model + +def ceilometer_upgrade(application_name=None, model_name=None): + zaza.model.run_action_on_leader( + application_name or self.application_name, + 'ceilometer-upgrade', + model_name=model_name, + action_params={}) +