diff options
Diffstat (limited to 'tests/conftest.py')
| -rw-r--r-- | tests/conftest.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index a0b8fd0b..d21f237c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
| @@ -245,6 +245,12 @@ def pytest_addoption(parser): | |||
| 245 | default=False, | 245 | default=False, |
| 246 | help="Skip registry tests that require network access to docker.io", | 246 | help="Skip registry tests that require network access to docker.io", |
| 247 | ) | 247 | ) |
| 248 | parser.addoption( | ||
| 249 | "--secure-registry", | ||
| 250 | action="store_true", | ||
| 251 | default=False, | ||
| 252 | help="Run secure registry tests (requires openssl, htpasswd)", | ||
| 253 | ) | ||
| 248 | 254 | ||
| 249 | 255 | ||
| 250 | def _cleanup_stale_test_state(): | 256 | def _cleanup_stale_test_state(): |
| @@ -577,6 +583,25 @@ def pytest_configure(config): | |||
| 577 | config.addinivalue_line( | 583 | config.addinivalue_line( |
| 578 | "markers", "network: marks tests that require network access" | 584 | "markers", "network: marks tests that require network access" |
| 579 | ) | 585 | ) |
| 586 | config.addinivalue_line( | ||
| 587 | "markers", "secure: marks tests that require secure registry mode (TLS/auth)" | ||
| 588 | ) | ||
| 589 | |||
| 590 | |||
| 591 | @pytest.fixture | ||
| 592 | def skip_secure(request): | ||
| 593 | """Skip if secure registry tests not enabled. | ||
| 594 | |||
| 595 | Use with tests that require secure registry infrastructure: | ||
| 596 | - openssl for certificate generation | ||
| 597 | - htpasswd for authentication setup | ||
| 598 | - CONTAINER_REGISTRY_SECURE=1 baked into script | ||
| 599 | |||
| 600 | Enable with: pytest --secure-registry | ||
| 601 | """ | ||
| 602 | if not request.config.getoption("--secure-registry"): | ||
| 603 | pytest.skip("Secure registry tests not enabled (use --secure-registry)") | ||
| 604 | return False | ||
| 580 | 605 | ||
| 581 | 606 | ||
| 582 | # ============================================================================ | 607 | # ============================================================================ |
