test(tests): make the body-retry, websocket debug-entry and gzip segment tests deterministic

This commit is contained in:
imSp4rky
2026-12-05 10:13:04 -07:00
parent 00ad15527c
commit 9de59f3142
4 changed files with 16 additions and 10 deletions
+5 -1
View File
@@ -10,12 +10,16 @@ from tests.core.test_rolling_merge_hls_ism import INIT, PARTS, hls_track, make_c
from unshackle.core.manifests import HLS
def cut_gzip(part: bytes) -> bytes:
return gzip.compress(part, mtime=0)[:-4]
@pytest.mark.parametrize(
"body, expected",
[
pytest.param(gzip.compress, lambda part: part, id="gzip"),
pytest.param(lambda part: b"\x1f\x8b\x08" + part, lambda part: b"\x1f\x8b\x08" + part, id="gzip-magic-only"),
pytest.param(lambda part: gzip.compress(part)[:-4], lambda part: gzip.compress(part)[:-4], id="cut-gzip"),
pytest.param(cut_gzip, cut_gzip, id="cut-gzip"),
],
)
def test_only_a_whole_gzip_segment_is_inflated(body, expected, server, tmp_path): # noqa: F811