[barbican] Retry on tls connection timeout

The GET request could get lost or stuck on the way to
loadbalancer->backend, so let's retry it.

Closes-Bug: PRODX-16055
Change-Id: Iab75cc251daba755dd248cda6b7b8c534283fc5d
(cherry picked from commit 01954d37942b7220243e914cecded8ac16d1a1c0)
(cherry picked from commit aa656cabf94e8a7679c06ad2e365b4e18caebf4d)
diff --git a/octavia_tempest_plugin/tests/barbican_scenario/v2/test_tls_barbican.py b/octavia_tempest_plugin/tests/barbican_scenario/v2/test_tls_barbican.py
index 511c724..6ec4766 100644
--- a/octavia_tempest_plugin/tests/barbican_scenario/v2/test_tls_barbican.py
+++ b/octavia_tempest_plugin/tests/barbican_scenario/v2/test_tls_barbican.py
@@ -22,6 +22,7 @@
 import httpx
 from OpenSSL.crypto import X509
 from OpenSSL import SSL
+import tenacity
 
 from oslo_log import log as logging
 from oslo_utils import uuidutils
@@ -1223,6 +1224,17 @@
         self.assertEqual(expected_proto, selected_proto)
 
     def _test_http_versions_tls_traffic(self, http_version, alpn_protos):
+        @tenacity.retry(
+            retry=tenacity.retry_if_exception_type(httpx.ConnectTimeout),
+            wait=tenacity.wait_incrementing(
+                const.RETRY_INITIAL_DELAY, const.RETRY_BACKOFF, const.RETRY_MAX
+            ),
+            stop=tenacity.stop_after_attempt(const.RETRY_ATTEMPTS),
+            reraise=True,
+        )
+        def _get(client, url):
+            return client.get(url)
+
         if not self.mem_listener_client.is_version_supported(
                 self.api_version, '2.20'):
             raise self.skipException('ALPN protocols are only available on '
@@ -1256,7 +1268,7 @@
 
         url = 'https://%s:%s' % (self.lb_vip_address, 443)
         client = httpx.Client(http2=(http_version == 'HTTP/2'), verify=context)
-        r = client.get(url)
+        r = _get(client, url)
         self.assertEqual(http_version, r.http_version)
 
     @decorators.idempotent_id('9965828d-24af-4fa0-91ae-21c6bc47ab4c')