feat: run isolated tests, fault stand, CI and bench over HTTPS and mTLS

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 07:08:47 +03:00
co-authored by Claude Opus 5.5
parent 51d84b6d76
commit b2ca2ae5d9
29 changed files with 1297 additions and 213 deletions
+24 -5
View File
@@ -9,7 +9,15 @@ from typing import Any
import httpx
import pytest
from api_client import CA_FILE, Actor, Api, tls_context
from api_client import (
CA_FILE,
TLS_SERVER_NAME,
Actor,
Api,
TlsSettingsError,
tls_context,
tls_extensions,
)
from spec_coverage import COLLECTED, Collected
# с лабы 7 — HTTPS балансировщика (change pki-ingress-mtls)
@@ -103,23 +111,34 @@ def _server_reachable() -> None:
"""Без сервера прогон останавливается одной строкой, а не 100 ошибками.
Так же — сертификат сервера, который не проходит проверку по `CA_FILE`
и hostname: адрес и причина одной строкой, код 2 до первого теста.
и имени сервера (`TLS_SERVER_NAME`, иначе hostname адреса): адрес, CA,
имя и причина одной строкой, код 2 до первого теста. Клиентский
сертификат без ключа (или наоборот) — тоже код 2.
"""
try:
context = tls_context()
except TlsSettingsError as exc:
pytest.exit(f"{exc} (for {BASE_URL})", returncode=2)
except (OSError, ssl.SSLError) as exc:
pytest.exit(
f"cannot load CA_FILE {CA_FILE!r} for {BASE_URL}: {exc}",
f"cannot load CA_FILE {CA_FILE!r} or the client certificate "
f"for {BASE_URL}: {exc}",
returncode=2,
)
try:
resp = httpx.get(f"{BASE_URL}/health/live", timeout=2, verify=context)
with httpx.Client(timeout=2, verify=context) as client:
resp = client.get(
f"{BASE_URL}/health/live",
extensions=tls_extensions(),
)
except httpx.HTTPError as exc:
cause = cert_verification_error(exc)
if cause is not None:
server_name = TLS_SERVER_NAME or httpx.URL(BASE_URL).host
pytest.exit(
f"server certificate at {BASE_URL} failed verification "
f"(CA_FILE {CA_FILE!r}): {cause.verify_message}",
f"(CA_FILE {CA_FILE!r}, server name {server_name!r}): "
f"{cause.verify_message}",
returncode=2,
)
pytest.exit(