103 lines
4.4 KiB
Plaintext
103 lines
4.4 KiB
Plaintext
Traceback (most recent call last):
|
|
File "<repository>/scripts/verify_clean.py", line 215, in <module>
|
|
main()
|
|
~~~~^^
|
|
File "<repository>/scripts/verify_clean.py", line 130, in main
|
|
receipt["http_tests"] = run(
|
|
~~~^
|
|
[".venv/bin/pytest", "student-tests", "-q"], cwd=clone, env=env
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
)
|
|
^
|
|
File "<repository>/scripts/verify_clean.py", line 55, in run
|
|
raise RuntimeError(redact(result.stdout + result.stderr))
|
|
RuntimeError: ...........................................................F............ [ 66%]
|
|
.................................... [100%]
|
|
=================================== FAILURES ===================================
|
|
____________________________ test_registration_race ____________________________
|
|
|
|
client = <httpx.Client object at 0x120c15790>
|
|
|
|
def test_registration_race(client):
|
|
username = "race_" + uuid4().hex[:20]
|
|
barrier = threading.Barrier(10)
|
|
|
|
def worker(_):
|
|
with httpx.Client(
|
|
base_url=BASE_URL, timeout=15, trust_env=False
|
|
) as conn:
|
|
barrier.wait(timeout=15)
|
|
result = conn.post(
|
|
"/api/v1/users",
|
|
json={
|
|
"username": username,
|
|
"display_name": "Test",
|
|
"password": PASSWORD,
|
|
},
|
|
)
|
|
check(
|
|
result,
|
|
result.status_code,
|
|
"User" if result.status_code == 201 else "Error",
|
|
)
|
|
return result.status_code
|
|
|
|
with ThreadPoolExecutor(max_workers=10) as pool:
|
|
> statuses = list(pool.map(worker, range(10)))
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
student-tests/test_api.py:406:
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/_base.py:645: in result_iterator
|
|
yield _result_or_cancel(fs.pop())
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/_base.py:312: in _result_or_cancel
|
|
return fut.result(timeout)
|
|
^^^^^^^^^^^^^^^^^^^
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/_base.py:454: in result
|
|
return self.__get_result()
|
|
^^^^^^^^^^^^^^^^^^^
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/_base.py:396: in __get_result
|
|
raise self._exception
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/thread.py:86: in run
|
|
result = ctx.run(self.task)
|
|
^^^^^^^^^^^^^^^^^^
|
|
<home>/.local/share/uv/python/cpython-3.14.7-macos-aarch64-none/lib/python3.14/concurrent/futures/thread.py:73: in run
|
|
return fn(*args, **kwargs)
|
|
^^^^^^^^^^^^^^^^^^^
|
|
student-tests/test_api.py:398: in worker
|
|
check(
|
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
|
|
|
|
result = <Response [503 Service Unavailable]>, status = 503, schema = 'Error'
|
|
|
|
def check(result: httpx.Response, status: int, schema: str) -> dict:
|
|
assert result.status_code == status, result.text
|
|
assert result.headers["x-request-id"]
|
|
assert result.headers["x-instance-id"]
|
|
assert result.headers["content-type"].startswith("application/json")
|
|
payload = result.json()
|
|
spec = {"$ref": f"#/components/schemas/{schema}", **CONTRACT}
|
|
Draft202012Validator(spec, format_checker=FormatChecker()).validate(
|
|
payload
|
|
)
|
|
if schema == "Error":
|
|
assert payload["error"]["request_id"] == result.headers["x-request-id"]
|
|
assert (
|
|
payload["error"]["code"]
|
|
> == {
|
|
400: "invalid_request",
|
|
401: "unauthorized",
|
|
404: "not_found",
|
|
409: "conflict",
|
|
500: "internal_error",
|
|
}[status]
|
|
)
|
|
E KeyError: 503
|
|
|
|
student-tests/conftest.py:32: KeyError
|
|
=========================== short test summary info ============================
|
|
FAILED student-tests/test_api.py::test_registration_race - KeyError: 503
|
|
1 failed, 107 passed in 377.89s (0:06:17)
|
|
|