Merge "Use the same ssl module httpx uses"

This commit is contained in:
Zuul 2024-09-27 07:25:06 +00:00 committed by Gerrit Code Review
commit 3d4cae3022

View File

@ -1256,7 +1256,18 @@ class TLSWithBarbicanTest(test_base.LoadBalancerBaseTestWithCompute):
const.ACTIVE,
CONF.load_balancer.build_interval,
CONF.load_balancer.build_timeout)
# TODO(johnsom) - Remove this once eventlet is removed from OpenStack
# NOTE(pas-ha): depending on what other tempest plugins are installed
# the eventlet might've been imported by that time, and, since
# dnspython 2.2.0, importing eventlet or any part of it effectively
# instantiates a dummy httpx.Client instance, thus pinning the ssl
# implementation in httpx to the eventlet's one.
# This leads to error in the Client() call below, as the ssl lib in
# this module is different from ssl lib in httpx._config,
# which fails isinstance check for ssl.SSLContext.
# Use the ssl module that is actually used by httpx to instantiate
# the SSL context to be used with httpx.
ssl = httpx._config.ssl
context = ssl.create_default_context(cadata=self.ca_cert.public_bytes(
serialization.Encoding.PEM).decode('utf-8'))
context.check_hostname = False