From 135e2dd8060bcda5cb1a2e44082192ff7aa50db0 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Mon, 4 May 2020 16:42:43 +0200 Subject: [PATCH 1/6] Re-enable neutron/test_800_ovs_bridges_are_managed_by_us --- zaza/openstack/charm_tests/neutron/tests.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index d94b47f..cb90b74 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -144,16 +144,12 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): self.assertIn('qos', ovs_agent['configurations']['extensions']) - @unittest.expectedFailure def test_800_ovs_bridges_are_managed_by_us(self): """Checking OVS bridges' external-id. OVS bridges created by us should be marked as managed by us in their external-id. See http://docs.openvswitch.org/en/latest/topics/integration/ - - NOTE(lourot): this test is expected to fail as long as this feature - hasn't landed yet: https://review.opendev.org/717074 """ for unit in zaza.model.get_units(self._APP_NAME, model_name=self.model_name): From 7fc0aa8bd96eb062ec49bb8909ddd2fa928e1a95 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Fri, 3 Jul 2020 15:26:52 +0200 Subject: [PATCH 2/6] Remove some deprecation warnings --- unit_tests/utilities/test_zaza_utilities_openstack.py | 4 ++-- zaza/openstack/utilities/generic.py | 2 +- zaza/openstack/utilities/openstack.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/unit_tests/utilities/test_zaza_utilities_openstack.py b/unit_tests/utilities/test_zaza_utilities_openstack.py index a6aa190..7271708 100644 --- a/unit_tests/utilities/test_zaza_utilities_openstack.py +++ b/unit_tests/utilities/test_zaza_utilities_openstack.py @@ -809,12 +809,12 @@ class TestOpenStackUtils(ut_utils.BaseTestCase): name='_get_os_version' ) self.patch( - 'zaza.openstack.utilities.juju.get_machines_for_application', + 'zaza.utilities.juju.get_machines_for_application', new_callable=mock.MagicMock(), name='_get_machines' ) self.patch( - 'zaza.openstack.utilities.juju.get_machine_series', + 'zaza.utilities.juju.get_machine_series', new_callable=mock.MagicMock(), name='_get_machine_series' ) diff --git a/zaza/openstack/utilities/generic.py b/zaza/openstack/utilities/generic.py index 0874cc6..dd8b1e0 100644 --- a/zaza/openstack/utilities/generic.py +++ b/zaza/openstack/utilities/generic.py @@ -23,9 +23,9 @@ import telnetlib import yaml from zaza import model -from zaza.openstack.utilities import juju as juju_utils from zaza.openstack.utilities import exceptions as zaza_exceptions from zaza.openstack.utilities.os_versions import UBUNTU_OPENSTACK_RELEASE +from zaza.utilities import juju as juju_utils def assertActionRanOK(action): diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 28ba29a..227d041 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -40,6 +40,7 @@ from keystoneauth1.identity import ( ) import zaza.openstack.utilities.cert as cert import zaza.utilities.deployment_env as deployment_env +import zaza.utilities.juju as juju_utils from novaclient import client as novaclient_client from neutronclient.v2_0 import client as neutronclient from neutronclient.common import exceptions as neutronexceptions @@ -66,7 +67,6 @@ from zaza import model from zaza.openstack.utilities import ( exceptions, generic as generic_utils, - juju as juju_utils, ) CIRROS_RELEASE_URL = 'http://download.cirros-cloud.net/version/released' From 16cee0193fa2dff1834bf8838f34a63add5fddca Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Fri, 3 Jul 2020 15:43:00 +0200 Subject: [PATCH 3/6] Make linter happy --- zaza/openstack/charm_tests/neutron/tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 4b1ff1b..c8c302a 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -23,7 +23,6 @@ import copy import logging import tenacity -import unittest import zaza import zaza.openstack.charm_tests.nova.utils as nova_utils From cac63150d93026774f134b64f28eb2c246d2d2e1 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Wed, 26 Aug 2020 12:59:40 +0200 Subject: [PATCH 4/6] Moved test to its own new class --- zaza/openstack/charm_tests/neutron/tests.py | 50 +++++++++++---------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 37a99db..b313488 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -147,29 +147,6 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): self.assertIn('qos', ovs_agent['configurations']['extensions']) - def test_800_ovs_bridges_are_managed_by_us(self): - """Checking OVS bridges' external-id. - - OVS bridges created by us should be marked as managed by us in their - external-id. See - http://docs.openvswitch.org/en/latest/topics/integration/ - """ - for unit in zaza.model.get_units(self._APP_NAME, - model_name=self.model_name): - for bridge_name in ('br-int', 'br-ex'): - logging.info( - 'Checking that the bridge {}:{}'.format( - unit.name, bridge_name - ) + ' is marked as managed by us' - ) - expected_external_id = 'charm-neutron-gateway=managed' - actual_external_id = zaza.model.run_on_unit( - unit.entity_id, - 'ovs-vsctl br-get-external-id {}'.format(bridge_name), - model_name=self.model_name - )['Stdout'].strip() - self.assertEqual(actual_external_id, expected_external_id) - def test_900_restart_on_config_change(self): """Checking restart happens on config change. @@ -612,6 +589,33 @@ class NeutronOpenvSwitchTest(NeutronPluginApiSharedTests): logging.info('Testing pause resume') +class NeutronOvsVsctlTest(NeutronPluginApiSharedTests): + """Test 'ovs-vsctl'-related functionality on Neutron charms.""" + + def test_800_ovs_bridges_are_managed_by_us(self): + """Checking OVS bridges' external-id. + + OVS bridges created by us should be marked as managed by us in their + external-id. See + http://docs.openvswitch.org/en/latest/topics/integration/ + """ + for unit in zaza.model.get_units(self.application_name, + model_name=self.model_name): + for bridge_name in ('br-int', 'br-ex'): + logging.info( + 'Checking that the bridge {}:{}'.format( + unit.name, bridge_name + ) + ' is marked as managed by us' + ) + expected_external_id = 'charm-neutron-gateway=managed' + actual_external_id = zaza.model.run_on_unit( + unit.entity_id, + 'ovs-vsctl br-get-external-id {}'.format(bridge_name), + model_name=self.model_name + )['Stdout'].strip() + self.assertEqual(actual_external_id, expected_external_id) + + class NeutronNetworkingBase(test_utils.OpenStackBaseTest): """Base for checking openstack instances have valid networking.""" From 52dc1354ffd170fcaa2fb802d3bb4cb32810fb77 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Wed, 26 Aug 2020 14:19:00 +0200 Subject: [PATCH 5/6] Fix setUpClass' signature --- zaza/openstack/charm_tests/neutron/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index b313488..62aa33b 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -34,9 +34,10 @@ import zaza.openstack.utilities.openstack as openstack_utils class NeutronPluginApiSharedTests(test_utils.OpenStackBaseTest): """Shared tests for Neutron Plugin API Charms.""" + @classmethod def setUpClass(cls): """Run class setup for running Neutron Openvswitch tests.""" - super(NeutronPluginApiSharedTests, cls).setUpClass() + super(NeutronPluginApiSharedTests, cls).setUpClass(cls) cls.current_os_release = openstack_utils.get_os_release() cls.bionic_stein = openstack_utils.get_os_release('bionic_stein') From fe82bc76f50265bd7b883235f2ec602fb615e36a Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Wed, 26 Aug 2020 16:34:28 +0200 Subject: [PATCH 6/6] Fix setUpClass' signature --- zaza/openstack/charm_tests/neutron/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 62aa33b..5d2f019 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -37,7 +37,7 @@ class NeutronPluginApiSharedTests(test_utils.OpenStackBaseTest): @classmethod def setUpClass(cls): """Run class setup for running Neutron Openvswitch tests.""" - super(NeutronPluginApiSharedTests, cls).setUpClass(cls) + super(NeutronPluginApiSharedTests, cls).setUpClass() cls.current_os_release = openstack_utils.get_os_release() cls.bionic_stein = openstack_utils.get_os_release('bionic_stein') @@ -109,7 +109,7 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): @classmethod def setUpClass(cls): """Run class setup for running Neutron Gateway tests.""" - super(NeutronGatewayTest, cls).setUpClass(cls) + super(NeutronGatewayTest, cls).setUpClass() cls.services = cls._get_services() # set up clients @@ -427,7 +427,7 @@ class NeutronOpenvSwitchTest(NeutronPluginApiSharedTests): @classmethod def setUpClass(cls): """Run class setup for running Neutron Openvswitch tests.""" - super(NeutronOpenvSwitchTest, cls).setUpClass(cls) + super(NeutronOpenvSwitchTest, cls).setUpClass() # set up client cls.neutron_client = (