From 06b9083f3c5b23e5c499f0828a2d66a83846689e Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Wed, 1 Apr 2020 09:23:48 +0200 Subject: [PATCH] Validate that charm-neutron-gateway marks bridges as managed by us https://bugs.launchpad.net/charm-neutron-gateway/+bug/1809190 --- zaza/openstack/charm_tests/neutron/tests.py | 36 ++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/neutron/tests.py b/zaza/openstack/charm_tests/neutron/tests.py index 2ae92f6..672cc95 100644 --- a/zaza/openstack/charm_tests/neutron/tests.py +++ b/zaza/openstack/charm_tests/neutron/tests.py @@ -14,7 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Encapsulating `neutron-openvswitch` testing.""" +"""Encapsulating testing of some `neutron-*` charms. + +`neutron-api`, `neutron-gateway` and `neutron-openvswitch` +""" import copy @@ -110,6 +113,31 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): super(NeutronGatewayTest, cls).setUpClass(cls) cls.services = cls._get_services() + _APP_NAME = 'neutron-gateway' + + 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. @@ -118,7 +146,7 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): """ # Expected default and alternate values current_value = zaza.model.get_application_config( - 'neutron-gateway')['debug']['value'] + self._APP_NAME)['debug']['value'] new_value = str(not bool(current_value)).title() current_value = str(current_value).title() @@ -132,7 +160,7 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): # Make config change, check for service restarts logging.info( - 'Setting verbose on neutron-api {}'.format(set_alternate)) + 'Setting verbose on {} {}'.format(self._APP_NAME, set_alternate)) self.restart_on_changed( conf_file, set_default, @@ -170,7 +198,7 @@ class NeutronGatewayTest(NeutronPluginApiSharedTests): logging.debug('Remote unit timestamp {}'.format(mtime)) with self.config_change(set_default, set_alternate): - for unit in zaza.model.get_units('neutron-gateway', + for unit in zaza.model.get_units(self._APP_NAME, model_name=self.model_name): logging.info('Checking number of profiles in complain ' 'mode in {}'.format(unit.entity_id))