mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 23:45:07 +00:00
test(tests): make the body-retry, websocket debug-entry and gzip segment tests deterministic
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
@@ -106,9 +107,9 @@ async def test_each_handshake_writes_one_debug_entry(debug_log: Path) -> None:
|
||||
with pytest.raises(rnet.ConnectionError):
|
||||
await call(session.websocket, closed_port().replace("http://", "ws://", 1), GIVEN)
|
||||
|
||||
assert [
|
||||
first, refused = [
|
||||
(entry["request"]["method"], entry["response"]["status"], entry["failure"]) for entry in records(debug_log)
|
||||
] == [
|
||||
("GET", 101, None),
|
||||
("GET", None, "ConnectionError (Connection refused)"),
|
||||
]
|
||||
assert first == ("GET", 101, None)
|
||||
assert refused[:2] == ("GET", None)
|
||||
assert re.fullmatch(r"ConnectionError \([^/]+\)", refused[2])
|
||||
|
||||
Reference in New Issue
Block a user