feat: benchmark direct media path (tests/test_app.py)
This commit is contained in:
parent
f9664d5e36
commit
fa01dd77fb
1 changed files with 16 additions and 1 deletions
|
|
@ -43,7 +43,7 @@ def test_health_exposes_current_version():
|
||||||
with TestClient(app.app) as client:
|
with TestClient(app.app) as client:
|
||||||
response = client.get("/health")
|
response = client.get("/health")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.json()["version"] == app.VERSION == "2.3.9"
|
assert response.json()["version"] == app.VERSION == "2.4.0"
|
||||||
|
|
||||||
|
|
||||||
def test_media_handoff_proxies_strict_category_contract(monkeypatch):
|
def test_media_handoff_proxies_strict_category_contract(monkeypatch):
|
||||||
|
|
@ -1355,3 +1355,18 @@ def test_sascha_media_tunnel_candidate_uses_valid_wireguard_interface_name():
|
||||||
script = base64.b64decode(encoded).decode()
|
script = base64.b64decode(encoded).decode()
|
||||||
assert 'root / "wgmtest.conf"' in script
|
assert 'root / "wgmtest.conf"' in script
|
||||||
assert len("wgmtest") <= 15
|
assert len("wgmtest") <= 15
|
||||||
|
|
||||||
|
|
||||||
|
def test_sascha_media_path_benchmark_returns_both_fixed_routes(monkeypatch):
|
||||||
|
monkeypatch.setattr(app, "_benchmark_sascha_media_paths", lambda: {
|
||||||
|
"legacy_node6": {"bytes": 268435456, "seconds": 4.0, "mbit_s": 536.9},
|
||||||
|
"direct_wg_media": {"bytes": 268435456, "seconds": 3.0, "mbit_s": 715.8},
|
||||||
|
})
|
||||||
|
with TestClient(app.app) as client:
|
||||||
|
response = client.post(
|
||||||
|
"/network/media-tunnel/sascha/benchmark",
|
||||||
|
headers={"Authorization": "Bearer test-token"},
|
||||||
|
)
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json()["direction"] == "emby-sascha_to_hetzner"
|
||||||
|
assert set(response.json()["results"]) == {"legacy_node6", "direct_wg_media"}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue