feat: крролик, по тщ 5 лаба

This commit is contained in:
Enterxx2
2026-11-10 12:38:09 +03:00
parent 1d8dfb7ea4
commit 595a959b96
65 changed files with 2692 additions and 216 deletions
+25 -2
View File
@@ -1,8 +1,8 @@
"""Общие проверки для собственных black-box тестов"""
import base64
import json
import io
import json
import struct
import subprocess
import uuid
@@ -212,5 +212,28 @@ def container_json(service: str, script: str) -> dict:
def run_janitor(*args: str) -> dict:
"""Один проход janitor внутри его контейнера; отчёт сверки"""
output = compose("exec", "-T", "janitor", "python", "src/janitor.py", "--once", *args)
output = compose(
"exec", "-T", "janitor", "python", "src/janitor.py", "--once", *args
)
return last_json_line(output)
def wait_attachment(
api: httpx.Client,
user: dict,
attachment_id: str,
terminal: str = "ready",
timeout: float = 60,
) -> dict:
import time
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
response = api.get(f"/api/v1/attachments/{attachment_id}", headers=auth(user))
assert response.status_code == 200, response.text
result = response.json()
if result["status"] in {"ready", "failed"}:
assert result["status"] == terminal, result
return result
time.sleep(0.1)
raise AssertionError(f"Вложение {attachment_id} не достигло {terminal}")