Skip to content

Commit

Permalink
dt: simplify pkcs12 test
Browse files Browse the repository at this point in the history
pkcs12 test doesn't need to test that topic creation works when
pkcs12 is not active. This is being actively tested by every other
test that implements a non-P12 TLSProvider
  • Loading branch information
IoannisRP committed Nov 14, 2024
1 parent 06a6fcb commit 41126c9
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tests/rptest/tests/pkcs12_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import socket

from ducktape.cluster.cluster import ClusterNode
from ducktape.mark import matrix
from ducktape.services.service import Service
from rptest.utils.mode_checks import skip_fips_mode
from rptest.clients.rpk import RpkTool
Expand All @@ -22,9 +21,8 @@


class P12TLSProvider(TLSProvider):
def __init__(self, tls: TLSCertManager, use_pkcs12: bool):
def __init__(self, tls: TLSCertManager):
self.tls = tls
self.use_pkcs12 = use_pkcs12

@property
def ca(self) -> CertificateAuthority:
Expand All @@ -41,7 +39,7 @@ def create_service_client_cert(self, _: Service, name: str) -> Certificate:
common_name=name)

def use_pkcs12_file(self) -> bool:
return self.use_pkcs12
return True

def p12_password(self, node: ClusterNode) -> str:
assert node.name in self.tls.certs, f"No certificate associated with node {node.name}"
Expand All @@ -64,9 +62,9 @@ def setUp(self):
# Skip set up to allow test to control how Redpanda's TLS settings are configured
pass

def _prepare_cluster(self, use_pkcs12: bool):
def _prepare_cluster(self):
self.tls = TLSCertManager(self.logger)
self.provider = P12TLSProvider(self.tls, use_pkcs12)
self.provider = P12TLSProvider(self.tls)
self.user_cert = self.tls.create_cert(socket.gethostname(),
common_name="walterP",
name="user")
Expand Down Expand Up @@ -94,12 +92,11 @@ def _prepare_cluster(self, use_pkcs12: bool):
# https://www.redhat.com/en/blog/fips-140-3-changes-pkcs-12
@skip_fips_mode
@cluster(num_nodes=3)
@matrix(use_pkcs12=[True, False])
def test_smoke(self, use_pkcs12: bool):
def test_smoke(self):
"""
Simple smoke test to verify that the PKCS12 file is being used
"""
self._prepare_cluster(use_pkcs12)
self._prepare_cluster()
TOPIC_NAME = "foo"
self.rpk.create_topic(TOPIC_NAME)
topics = [t for t in self.rpk.list_topics()]
Expand Down

0 comments on commit 41126c9

Please sign in to comment.