add test to see if fail for streams and evetns

This commit is contained in:
larssand
2026-07-02 10:51:56 +02:00
parent 19e65da697
commit a8c00c35b2
4 changed files with 57 additions and 1 deletions

View File

@@ -135,7 +135,13 @@ def build_status(
stream_configs = [item for item in configured_streams if isinstance(item, dict) and item.get("enabled") and item.get("id")]
stream_ids = [str(item.get("id")) for item in stream_configs]
if not stream_ids:
stream_configs = [{"id": str(runtime_values.get("graylog_stream", "")), "title": "Graylog"}]
legacy_stream = str(runtime_values.get("graylog_stream", "") or "")
if legacy_stream:
stream_configs = [{"id": legacy_stream, "title": "Graylog"}]
else:
mcp_status = {"status": "no_streams_enabled", "streams": [], "events_fetched": 0, "coverage_status": "no_streams_enabled"}
events = []
raise StopIteration
stream_statuses = []
events = []
range_seconds = _range_seconds(runtime_values.get("graylog_range_seconds", 300))
@@ -193,6 +199,8 @@ def build_status(
"coverage_status": "partial" if partial_streams else "truncated" if truncated_streams else "complete_window",
"coverage_warning": " ".join(warnings),
}
except StopIteration:
pass
except RuntimeError as exc:
mcp_status = {"status": "error", "error": str(exc)}
events = []