From 6645c60e93bd70ae5ef0302cacf63d83299f418d Mon Sep 17 00:00:00 2001 From: David Ames Date: Wed, 9 Jun 2021 03:20:53 -0700 Subject: [PATCH] Handle Vault running tests twice (#588) Vault's runs its tests twice. In some circumstances the removal of the vault key from the test_config dictionary can throw a KeyError. Do not fail when this happens. --- zaza/openstack/charm_tests/vault/tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/vault/tests.py b/zaza/openstack/charm_tests/vault/tests.py index 29719d5..9014928 100644 --- a/zaza/openstack/charm_tests/vault/tests.py +++ b/zaza/openstack/charm_tests/vault/tests.py @@ -111,7 +111,11 @@ class UnsealVault(BaseVaultTest): vault_utils.run_charm_authorize(self.vault_creds['root_token']) if not test_config: test_config = lifecycle_utils.get_charm_config() - del test_config['target_deploy_status']['vault'] + try: + del test_config['target_deploy_status']['vault'] + except KeyError: + # Already removed + pass zaza.model.wait_for_application_states( states=test_config.get('target_deploy_status', {})) @@ -154,7 +158,11 @@ class VaultTest(BaseVaultTest): allowed_domains='openstack.local') test_config = lifecycle_utils.get_charm_config() - del test_config['target_deploy_status']['vault'] + try: + del test_config['target_deploy_status']['vault'] + except KeyError: + # Already removed + pass zaza.openstack.utilities.openstack.block_until_ca_exists( 'keystone', cacert.decode().strip())