From 0b5fd89708af4195f5e5967a209de56f5cacec4b Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Thu, 6 Oct 2022 21:19:29 -0700 Subject: [PATCH] no rfc tests --- .../rfc2136_tests/__init__.py | 0 .../rfc2136_tests/context.py | 67 ------------------- .../rfc2136_tests/test_main.py | 28 -------- 3 files changed, 95 deletions(-) delete mode 100644 certbot-ci/certbot_integration_tests/rfc2136_tests/__init__.py delete mode 100644 certbot-ci/certbot_integration_tests/rfc2136_tests/context.py delete mode 100644 certbot-ci/certbot_integration_tests/rfc2136_tests/test_main.py diff --git a/certbot-ci/certbot_integration_tests/rfc2136_tests/__init__.py b/certbot-ci/certbot_integration_tests/rfc2136_tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py b/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py deleted file mode 100644 index dde41f367..000000000 --- a/certbot-ci/certbot_integration_tests/rfc2136_tests/context.py +++ /dev/null @@ -1,67 +0,0 @@ -"""Module to handle the context of RFC2136 integration tests.""" - -from contextlib import contextmanager -import tempfile -from typing import Generator -from typing import Iterable -from typing import Tuple - -from pkg_resources import resource_filename -import pytest - -from certbot_integration_tests.certbot_tests import context as certbot_context -from certbot_integration_tests.utils import certbot_call - - -class IntegrationTestsContext(certbot_context.IntegrationTestsContext): - """Integration test context for certbot-dns-rfc2136""" - def __init__(self, request: pytest.FixtureRequest) -> None: - super().__init__(request) - - self.request = request - - if hasattr(request.config, 'workerinput'): # Worker node - self._dns_xdist = request.config.workerinput['dns_xdist'] # type: ignore[attr-defined] - else: # Primary node - self._dns_xdist = request.config.dns_xdist # type: ignore[attr-defined] - - def certbot_test_rfc2136(self, args: Iterable[str]) -> Tuple[str, str]: - """ - Main command to execute certbot using the RFC2136 DNS authenticator. - :param list args: list of arguments to pass to Certbot - """ - command = ['--authenticator', 'dns-rfc2136', '--dns-rfc2136-propagation-seconds', '2'] - command.extend(args) - return certbot_call.certbot_test( - command, self.directory_url, self.http_01_port, self.tls_alpn_01_port, - self.config_dir, self.workspace, force_renew=True) - - @contextmanager - def rfc2136_credentials(self, label: str = 'default') -> Generator[str, None, None]: - """ - Produces the contents of a certbot-dns-rfc2136 credentials file. - :param str label: which RFC2136 credential to use - :yields: Path to credentials file - :rtype: str - """ - src_file = resource_filename('certbot_integration_tests', - 'assets/bind-config/rfc2136-credentials-{}.ini.tpl' - .format(label)) - - with open(src_file, 'r') as f: - contents = f.read().format( - server_address=self._dns_xdist['address'], - server_port=self._dns_xdist['port'] - ) - - with tempfile.NamedTemporaryFile('w+', prefix='rfc2136-creds-{}'.format(label), - suffix='.ini', dir=self.workspace) as fp: - fp.write(contents) - fp.flush() - yield fp.name - - def skip_if_no_bind9_server(self) -> None: - """Skips the test if there was no RFC2136-capable DNS server configured - in the test environment""" - if not self._dns_xdist: - pytest.skip('No RFC2136-capable DNS server is configured') diff --git a/certbot-ci/certbot_integration_tests/rfc2136_tests/test_main.py b/certbot-ci/certbot_integration_tests/rfc2136_tests/test_main.py deleted file mode 100644 index 9466934a8..000000000 --- a/certbot-ci/certbot_integration_tests/rfc2136_tests/test_main.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Module executing integration tests against Certbot with the RFC2136 DNS authenticator.""" -from typing import Generator - -import pytest - -from certbot_integration_tests.rfc2136_tests.context import IntegrationTestsContext - - -@pytest.fixture(name="context") -def test_context(request: pytest.FixtureRequest) -> Generator[IntegrationTestsContext, None, None]: - # pylint: disable=missing-function-docstring - # Fixture request is a built-in pytest fixture describing current test request. - integration_test_context = IntegrationTestsContext(request) - try: - yield integration_test_context - finally: - integration_test_context.cleanup() - - -@pytest.mark.parametrize('domain', [('example.com'), ('sub.example.com')]) -def test_get_certificate(domain: str, context: IntegrationTestsContext) -> None: - context.skip_if_no_bind9_server() - - with context.rfc2136_credentials() as creds: - context.certbot_test_rfc2136([ - 'certonly', '--dns-rfc2136-credentials', creds, - '-d', domain, '-d', '*.{}'.format(domain) - ])