From ea341f1eb4a1cc4d7447ceb16a34352fd90af362 Mon Sep 17 00:00:00 2001 From: Gabriel Angelo Sgarbi Cocenza Date: Thu, 29 Jul 2021 06:09:33 -0300 Subject: [PATCH] Check blocked ovn-chassis units with bad config (#605) * Check blocked ovn-chassis units with bad config LP bug#1919481 [0] needs to have a func-test to check if units can handle bad bridge-interface-mappings configuration and set units workload to block state and return to active state with good config. [0] https://bugs.launchpad.net/charm-ovn-chassis/+bug/1919481 * Changing test_wrong_bridge_config to use config_change Instead of using block_until_unit_wl_status, change the test_config to be able to check blocked state for ovn-chassis units Co-authored-by: Aurelien Lourot --- zaza/openstack/charm_tests/ovn/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zaza/openstack/charm_tests/ovn/tests.py b/zaza/openstack/charm_tests/ovn/tests.py index 2478d66..43409ae 100644 --- a/zaza/openstack/charm_tests/ovn/tests.py +++ b/zaza/openstack/charm_tests/ovn/tests.py @@ -168,6 +168,28 @@ class ChassisCharmOperationTest(BaseCharmOperationTest): '{}: "{}" no longer present' .format(unit.entity_id, expected_key)) + def test_wrong_bridge_config(self): + """Confirm that ovn-chassis units block with wrong bridge config.""" + stored_target_deploy_status = self.test_config.get( + 'target_deploy_status', {}) + new_target_deploy_status = stored_target_deploy_status.copy() + new_target_deploy_status[self.application_name] = { + 'ovn-chassis': 'blocked', + } + if 'target_deploy_status' in self.test_config: + self.test_config['target_deploy_status'].update( + new_target_deploy_status) + else: + self.test_config['target_deploy_status'] = new_target_deploy_status + + with self.config_change( + {'bridge-interface-mappings': ''}, + {'bridge-interface-mappings': 'incorrect'}): + logging.info('Charm went into blocked state as expected, restore ' + 'configuration') + self.test_config[ + 'target_deploy_status'] = stored_target_deploy_status + class OVSOVNMigrationTest(test_utils.BaseCharmTest): """OVS to OVN migration tests."""