First cut
This commit is contained in:
BIN
zaza/openstack/charm_tests/aodh/.tests.py.swp
Normal file
BIN
zaza/openstack/charm_tests/aodh/.tests.py.swp
Normal file
Binary file not shown.
15
zaza/openstack/charm_tests/aodh/__init__.py
Normal file
15
zaza/openstack/charm_tests/aodh/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
# 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.
|
||||
|
||||
"""Collection of code for setting up and testing masakari."""
|
||||
22
zaza/openstack/charm_tests/aodh/setup.py
Normal file
22
zaza/openstack/charm_tests/aodh/setup.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# 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.
|
||||
|
||||
"""Code for setting up aodh tests."""
|
||||
|
||||
import zaza.openstack.configure.telemetry
|
||||
|
||||
|
||||
def ceilometer_upgrade():
|
||||
"""Run ceilometer upgrade action."""
|
||||
zaza.openstack.configure.telemetry.ceilometer_upgrade()
|
||||
101
zaza/openstack/charm_tests/aodh/tests.py
Normal file
101
zaza/openstack/charm_tests/aodh/tests.py
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# 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.
|
||||
|
||||
"""Encapsulate masakari testing."""
|
||||
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
import zaza.model
|
||||
import zaza.openstack.charm_tests.test_utils as test_utils
|
||||
import zaza.openstack.utilities.juju as juju_utils
|
||||
import zaza.openstack.utilities.openstack as openstack_utils
|
||||
|
||||
|
||||
class AodhTest(test_utils.OpenStackBaseTest):
|
||||
"""Encapsulate Aodh tests."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
"""Run class setup for running tests."""
|
||||
super(AodhTest, cls).setUpClass()
|
||||
cls.xenial_ocata = openstack_utils.get_os_release('xenial_ocata')
|
||||
cls.xenial_newton = openstack_utils.get_os_release('xenial_newton')
|
||||
cls.release = openstack_utils.get_os_release()
|
||||
|
||||
@property
|
||||
def services(self):
|
||||
if self.release >= 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")
|
||||
31
zaza/openstack/configure/telemetry.py
Normal file
31
zaza/openstack/configure/telemetry.py
Normal file
@@ -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={})
|
||||
|
||||
Reference in New Issue
Block a user