test: add idle S3 upload fault check on a short S3 timeout API
Fourth API of the failure stand (S3__TIMEOUT_SECONDS=1), slow streamed download in the test client, test_upload_after_idle_s3 and the fix-upload-put-flake spec deltas synced into the main specs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,9 +24,14 @@ FAULT_TIGHT_BASE_URL = os.environ.get("FAULT_TIGHT_BASE_URL", "").rstrip("/")
|
||||
FAULT_UPLOADS_BASE_URL = os.environ.get("FAULT_UPLOADS_BASE_URL", "").rstrip(
|
||||
"/",
|
||||
)
|
||||
# API стенда отказов с коротким сроком вызова S3 (change fix-upload-put-flake)
|
||||
FAULT_S3_BASE_URL = os.environ.get("FAULT_S3_BASE_URL", "").rstrip("/")
|
||||
FAULT_HOOK_TIMEOUT_S = 120
|
||||
# срок клиента «узкого» API: больше ожидания места, срока тела и шагов
|
||||
UPLOADS_CLIENT_TIMEOUT_S = 30
|
||||
# срок клиента API с коротким сроком S3: медленное скачивание оригинала
|
||||
# в несколько MiB длится дольше 5 с по умолчанию у `Api`
|
||||
S3_CLIENT_TIMEOUT_S = 30
|
||||
|
||||
|
||||
@pytest.hookimpl(tryfirst=True)
|
||||
@@ -60,7 +65,10 @@ def pytest_collection_finish(session: pytest.Session) -> None:
|
||||
item for item in session.items if item.get_closest_marker("fault")
|
||||
]
|
||||
if selected and not (
|
||||
FAULT_HOOK and FAULT_TIGHT_BASE_URL and FAULT_UPLOADS_BASE_URL
|
||||
FAULT_HOOK
|
||||
and FAULT_TIGHT_BASE_URL
|
||||
and FAULT_UPLOADS_BASE_URL
|
||||
and FAULT_S3_BASE_URL
|
||||
):
|
||||
pytest.exit(
|
||||
"fault checks need the failure stand and its hook: "
|
||||
@@ -184,3 +192,10 @@ def uploads_api() -> Iterator[Api]:
|
||||
timeout=UPLOADS_CLIENT_TIMEOUT_S,
|
||||
) as client:
|
||||
yield client
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def s3_api() -> Iterator[Api]:
|
||||
"""API стенда отказов со сроком вызова S3 1 с (`FAULT_S3_ENV`)."""
|
||||
with Api(FAULT_S3_BASE_URL, timeout=S3_CLIENT_TIMEOUT_S) as client:
|
||||
yield client
|
||||
|
||||
Reference in New Issue
Block a user