From 88d0b4c64f5c730a9b134276b9b5001d35ded005 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Thu, 9 Nov 2023 09:28:24 +0200 Subject: [PATCH 1/2] Add ObjectRetrierWraps for cinder/nova clients in cinder tests Due to how apache2 & haproxy interact on the cinder unit, this adds the ObjectRetrier to the cinder and nova clients to allow for the time delay between the apache2 service starting and the haproxy service noticing and opening the port. This allows the test_100... cinder test to function as (technically) there isn't an error. --- zaza/openstack/charm_tests/cinder/tests.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/zaza/openstack/charm_tests/cinder/tests.py b/zaza/openstack/charm_tests/cinder/tests.py index 421d30631..43d2fc73c 100644 --- a/zaza/openstack/charm_tests/cinder/tests.py +++ b/zaza/openstack/charm_tests/cinder/tests.py @@ -27,6 +27,7 @@ import zaza.openstack.configure.guest as guest import zaza.openstack.charm_tests.nova.utils as nova_utils import zaza.openstack.charm_tests.tempest.tests as tempest_tests +from zaza.openstack.utilities import ObjectRetrierWraps from tenacity import ( Retrying, @@ -48,10 +49,14 @@ def setUpClass(cls): cls.lead_unit = zaza.model.get_lead_unit_name( "cinder", model_name=cls.model_name) # version 3.42 is required for in-use (online) resizing lvm volumes - cls.cinder_client = openstack_utils.get_cinder_session_client( - cls.keystone_session, version=3.42) - cls.nova_client = openstack_utils.get_nova_session_client( - cls.keystone_session) + # Add retries to cinder and nova to allow for async restart issues and + # services becoming ready between configuration and individual tests. + cls.cinder_client = ObjectRetrierWraps( + openstack_utils.get_cinder_session_client( + cls.keystone_session, version=3.42)) + cls.nova_client = ObjectRetrierWraps( + openstack_utils.get_nova_session_client( + cls.keystone_session)) @classmethod def tearDown(cls): From 1b464906201d32708a6e15c34516347cb3569f56 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Fri, 10 Nov 2023 11:44:12 +0200 Subject: [PATCH 2/2] Also add retrier for cinder_backup tests These are needed to make the cinder_backup tests more resilient. --- zaza/openstack/charm_tests/cinder_backup/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/cinder_backup/tests.py b/zaza/openstack/charm_tests/cinder_backup/tests.py index 97b365808..ff36864a5 100644 --- a/zaza/openstack/charm_tests/cinder_backup/tests.py +++ b/zaza/openstack/charm_tests/cinder_backup/tests.py @@ -24,6 +24,7 @@ import zaza.openstack.charm_tests.test_utils as test_utils import zaza.openstack.utilities.ceph as ceph_utils import zaza.openstack.utilities.openstack as openstack_utils +from zaza.openstack.utilities import ObjectRetrierWraps class CinderBackupTest(test_utils.OpenStackBaseTest): @@ -35,8 +36,9 @@ class CinderBackupTest(test_utils.OpenStackBaseTest): def setUpClass(cls): """Run class setup for running Cinder Backup tests.""" super(CinderBackupTest, cls).setUpClass() - cls.cinder_client = openstack_utils.get_cinder_session_client( - cls.keystone_session) + cls.cinder_client = ObjectRetrierWraps( + openstack_utils.get_cinder_session_client( + cls.keystone_session)) @property def services(self):