From 8edff98f94ea39b901caf02982a705f32cc7ab36 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Fri, 8 May 2020 08:28:24 +0200 Subject: [PATCH] Add OVN charm tests --- zaza/openstack/charm_tests/ovn/__init__.py | 15 +++++ zaza/openstack/charm_tests/ovn/tests.py | 73 ++++++++++++++++++++++ zaza/openstack/utilities/openstack.py | 5 ++ zaza/openstack/utilities/os_versions.py | 4 ++ 4 files changed, 97 insertions(+) create mode 100644 zaza/openstack/charm_tests/ovn/__init__.py create mode 100644 zaza/openstack/charm_tests/ovn/tests.py diff --git a/zaza/openstack/charm_tests/ovn/__init__.py b/zaza/openstack/charm_tests/ovn/__init__.py new file mode 100644 index 0000000..bd5900c --- /dev/null +++ b/zaza/openstack/charm_tests/ovn/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2020 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 OVN.""" diff --git a/zaza/openstack/charm_tests/ovn/tests.py b/zaza/openstack/charm_tests/ovn/tests.py new file mode 100644 index 0000000..0708c67 --- /dev/null +++ b/zaza/openstack/charm_tests/ovn/tests.py @@ -0,0 +1,73 @@ +# Copyright 2020 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 OVN testing.""" + +import logging + +import zaza.openstack.charm_tests.test_utils as test_utils +import zaza.openstack.utilities.openstack as openstack_utils + + +class BaseCharmOperationTest(test_utils.BaseCharmTest): + """Base OVN Charm operation tests.""" + + # override if not possible to determine release pair from charm under test + release_application = None + + @classmethod + def setUpClass(cls): + """Run class setup for OVN charm operation tests.""" + super(BaseCharmOperationTest, cls).setUpClass() + cls.services = ['NotImplemented'] # This must be overridden + cls.current_release = openstack_utils.get_os_release( + openstack_utils.get_current_os_release_pair( + cls.release_application or cls.application_name)) + + def test_pause_resume(self): + """Run pause and resume tests. + + Pause service and check services are stopped, then resume and check + they are started. + """ + with self.pause_resume(self.services): + logging.info('Testing pause resume (services="{}")' + .format(self.services)) + + +class CentralCharmOperationTest(BaseCharmOperationTest): + """OVN Central Charm operation tests.""" + + @classmethod + def setUpClass(cls): + """Run class setup for OVN Central charm operation tests.""" + super(CentralCharmOperationTest, cls).setUpClass() + cls.services = [ + 'ovn-northd', + 'ovsdb-server', + ] + + +class ChassisCharmOperationTest(BaseCharmOperationTest): + """OVN Chassis Charm operation tests.""" + + release_application = 'ovn-central' + + @classmethod + def setUpClass(cls): + """Run class setup for OVN Chassis charm operation tests.""" + super(ChassisCharmOperationTest, cls).setUpClass() + cls.services = [ + 'ovn-controller', + ] diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 98bb838..5c7d46a 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -108,6 +108,10 @@ CHARM_TYPES = { 'pkg': 'designate-common', 'origin_setting': 'openstack-origin' }, + 'ovn-central': { + 'pkg': 'ovn-common', + 'origin_setting': 'source' + }, } # Older tests use the order the services appear in the list to imply @@ -126,6 +130,7 @@ UPGRADE_SERVICES = [ {'name': 'nova-compute', 'type': CHARM_TYPES['nova']}, {'name': 'openstack-dashboard', 'type': CHARM_TYPES['openstack-dashboard']}, + {'name': 'ovn-central', 'type': CHARM_TYPES['ovn-central']}, ] diff --git a/zaza/openstack/utilities/os_versions.py b/zaza/openstack/utilities/os_versions.py index 4ffd445..b2e430e 100644 --- a/zaza/openstack/utilities/os_versions.py +++ b/zaza/openstack/utilities/os_versions.py @@ -230,4 +230,8 @@ PACKAGE_CODENAMES = { ('9', 'train'), ('10', 'ussuri'), ]), + 'ovn-common': OrderedDict([ + ('2', 'train'), + ('20', 'ussuri'), + ]), }