fix entriy view UI

This commit is contained in:
larssand
2026-07-02 20:26:42 +02:00
parent e260e51e67
commit 48b56852cf
3 changed files with 54 additions and 9 deletions

View File

@@ -68,6 +68,35 @@ class MonitorTests(unittest.TestCase):
self.assertEqual(status["capabilities"]["graylog_mcp"]["previous_fetch_mode"], "aggregate")
self.assertFalse(status["status_cache"]["served_from_cache"])
def test_write_refreshing_status_uses_last_good_cache(self):
with tempfile.TemporaryDirectory() as tmp:
output = Path(tmp) / "status.json"
cache_path = str(Path(tmp) / "status-cache.sqlite3")
output.write_text(
json.dumps({"capabilities": {"graylog_mcp": {"status": "refreshing", "events_fetched": 0, "aggregate_events": 0}}}),
encoding="utf-8",
)
StatusSnapshotStore(cache_path).save(
"last_good",
{
"summary": {"total": 1234},
"capabilities": {"graylog_mcp": {"status": "connected", "events_fetched": 99, "raw_events_fetched": 88, "aggregate_events": 1234, "fetch_mode": "aggregate", "coverage_status": "complete_window"}},
"cross_source_correlations": [{"entity": "10.0.0.1", "entity_label": "host01 (10.0.0.1)"}],
},
)
write_refreshing_status(str(output), cache_path=cache_path)
status = json.loads(output.read_text(encoding="utf-8"))
mcp = status["capabilities"]["graylog_mcp"]
self.assertEqual(status["summary"]["total"], 1234)
self.assertEqual(mcp["status"], "refreshing")
self.assertEqual(mcp["events_fetched"], 99)
self.assertEqual(mcp["raw_events_fetched"], 88)
self.assertEqual(mcp["aggregate_events"], 1234)
self.assertEqual(mcp["previous_status"], "connected")
self.assertTrue(status["status_cache"]["served_from_cache"])
def test_profile_readiness_includes_stream_and_profile_names(self):
with tempfile.TemporaryDirectory() as tmp:
config_path = Path(tmp) / "config.json"