Skip to content

Commit

Permalink
Support certificate name(s) in test suite.
Browse files Browse the repository at this point in the history
  • Loading branch information
jimf5 committed May 4, 2024
1 parent 51dfeeb commit 83f9fa3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
).decode("utf-8")


def self_signed_cert(test_dir):
name = "localhost"
def self_signed_cert(test_dir, name):
k = crypto.PKey()
k.generate_key(crypto.TYPE_RSA, 2048)
cert = crypto.X509()
Expand Down Expand Up @@ -66,7 +65,7 @@ def nginx_config(request, testdir, logger):


@pytest.fixture(scope="module")
def nginx(testdir, nginx_config, certs, logger):
def nginx(testdir, nginx_config, _certs, logger):
logger.debug(CAPABILITIES)
(testdir / "nginx.conf").write_text(nginx_config)
logger.info("Starting nginx...")
Expand Down Expand Up @@ -101,6 +100,7 @@ def nginx(testdir, nginx_config, certs, logger):


@pytest.fixture(scope="module")
def certs(request, testdir):
if getattr(request.module, "CERT_GEN", None) is not None:
return request.module.CERT_GEN(testdir)
def _certs(request, testdir):
if getattr(request.module, "CERTS", None) is not None:
for _ in request.module.CERTS[1:]:
request.module.CERTS[0](testdir, _)
2 changes: 1 addition & 1 deletion tests/test_otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import urllib3


CERT_GEN = self_signed_cert
CERTS = [self_signed_cert, "localhost"]

NGINX_CONFIG = """
{{ test_globals }}
Expand Down

0 comments on commit 83f9fa3

Please sign in to comment.