Publish curated Unraid-AppOps-Gateway source from 034c9f844d2455850ba37b31379b7edaa786583e
This commit is contained in:
1 parent
c61fbfd87f
commit
1a54836efc
101 files changed
+4973
-1298
No files matched your search
@@ -155,6 +155,7 @@ def test_media_pipeline_summary_reuses_persistent_cache_after_snapshot_loss(api_
|
||||
def test_media_pipeline_snapshot_cache_prevents_concurrent_stampede(api_client, monkeypatch):
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from time import sleep
|
||||
|
||||
from backend.app.services import media_pipeline_service
|
||||
|
||||
payloads = _patch_pipeline(monkeypatch)
|
||||
@@ -177,6 +178,7 @@ def test_media_pipeline_snapshot_cache_prevents_concurrent_stampede(api_client,
|
||||
|
||||
def test_media_pipeline_cold_snapshot_runs_connector_reads_in_parallel(api_client, monkeypatch):
|
||||
from threading import Barrier
|
||||
|
||||
from backend.app.services import media_pipeline_service
|
||||
|
||||
payloads = _patch_pipeline(monkeypatch)
|
||||
@@ -230,6 +232,86 @@ def test_media_pipeline_flow_returns_nodes_and_edges(api_client, monkeypatch):
|
||||
assert not any("delete" in action or "remove" in action for action in action_ids)
|
||||
|
||||
|
||||
def test_media_pipeline_flow_has_no_healthy_edges_when_configuration_is_missing(api_client, monkeypatch):
|
||||
payloads = _healthy_payloads()
|
||||
for connector in ("sonarr", "prowlarr", "deluge", "widefrog", "plex", "tautulli"):
|
||||
payloads[f"{connector}_health"] = {"success": False, "status": "missing_config"}
|
||||
_patch_pipeline(monkeypatch, payloads)
|
||||
|
||||
response = api_client.get("/api/media-pipeline/flow")
|
||||
|
||||
assert response.status_code == 200
|
||||
payload = response.json()
|
||||
assert len(payload["edges"]) == 4
|
||||
assert all(edge["status"] == "unknown" for edge in payload["edges"])
|
||||
assert all(node["status"] == "missing_config" for node in payload["nodes"])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("connector", ["sonarr", "prowlarr", "deluge", "widefrog", "plex", "tautulli"])
|
||||
@pytest.mark.parametrize("health_status,expected", [
|
||||
("missing_config", "unknown"),
|
||||
("unknown", "unknown"),
|
||||
("unavailable", "unknown"),
|
||||
("unsupported", "unknown"),
|
||||
("unexpected_state", "unknown"),
|
||||
("auth_failed", "broken"),
|
||||
("unreachable", "broken"),
|
||||
("error", "broken"),
|
||||
])
|
||||
def test_media_pipeline_flow_checks_each_endpoint_before_queue_warnings(api_client, monkeypatch, connector, health_status, expected):
|
||||
payloads = _healthy_payloads()
|
||||
payloads[f"{connector}_health"] = {"success": False, "status": health_status}
|
||||
# Nonzero counts must never turn unavailable or failed endpoints amber/green.
|
||||
payloads["prowlarr_indexers"]["failing"] = 2
|
||||
payloads["widefrog_failed"]["failed"] = 3
|
||||
_patch_pipeline(monkeypatch, payloads)
|
||||
|
||||
response = api_client.get("/api/media-pipeline/flow")
|
||||
|
||||
assert response.status_code == 200
|
||||
edges = response.json()["edges"]
|
||||
unrelated_statuses = {
|
||||
("sonarr", "prowlarr"): "healthy",
|
||||
("prowlarr", "deluge"): "warning",
|
||||
("widefrog", "plex"): "warning",
|
||||
("plex", "tautulli"): "healthy",
|
||||
}
|
||||
for edge in edges:
|
||||
if connector in (edge["from"], edge["to"]):
|
||||
assert edge["status"] == expected
|
||||
else:
|
||||
assert edge["status"] == unrelated_statuses[(edge["from"], edge["to"])]
|
||||
|
||||
|
||||
def test_media_pipeline_flow_unknown_endpoint_precedes_failure_on_the_other_endpoint(api_client, monkeypatch):
|
||||
payloads = _healthy_payloads()
|
||||
payloads["prowlarr_health"] = {"success": False, "status": "unreachable"}
|
||||
payloads["deluge_health"] = {"success": False, "status": "missing_config"}
|
||||
_patch_pipeline(monkeypatch, payloads)
|
||||
|
||||
payload = api_client.get("/api/media-pipeline/flow").json()
|
||||
edge_statuses = {(edge["from"], edge["to"]): edge["status"] for edge in payload["edges"]}
|
||||
|
||||
assert edge_statuses[("sonarr", "prowlarr")] == "broken"
|
||||
assert edge_statuses[("prowlarr", "deluge")] == "unknown"
|
||||
|
||||
|
||||
def test_media_pipeline_flow_applies_queue_warnings_only_with_connected_endpoints(api_client, monkeypatch):
|
||||
payloads = _healthy_payloads()
|
||||
payloads["prowlarr_indexers"]["failing"] = 2
|
||||
payloads["widefrog_failed"]["failed"] = 3
|
||||
_patch_pipeline(monkeypatch, payloads)
|
||||
|
||||
payload = api_client.get("/api/media-pipeline/flow").json()
|
||||
|
||||
assert {(edge["from"], edge["to"]): edge["status"] for edge in payload["edges"]} == {
|
||||
("sonarr", "prowlarr"): "healthy",
|
||||
("prowlarr", "deluge"): "warning",
|
||||
("widefrog", "plex"): "warning",
|
||||
("plex", "tautulli"): "healthy",
|
||||
}
|
||||
|
||||
|
||||
def test_media_pipeline_issues_detect_cross_connector_problems(api_client, monkeypatch):
|
||||
payloads = _healthy_payloads()
|
||||
payloads["prowlarr_indexers"] = {"success": True, "status": "ok", "total": 3, "enabled": 2, "failing": 1, "items": [{"name": "Indexer", "status": "error"}]}
|
||||
@@ -267,9 +349,10 @@ def test_deluge_stalled_issue_includes_source_and_timestamp(api_client, monkeypa
|
||||
|
||||
|
||||
def test_media_pipeline_issues_handles_review_apps_without_connector_type(api_client, monkeypatch):
|
||||
from sqlmodel import Session
|
||||
|
||||
from backend.app.db.models import App
|
||||
from backend.app.db.session import engine
|
||||
from sqlmodel import Session
|
||||
|
||||
_patch_pipeline(monkeypatch)
|
||||
with Session(engine) as session:
|
||||
|
||||
Reference in new issue
Block a user