Improved the overview graphs. and MCP fetching poll

This commit is contained in:
larssand
2026-06-30 09:40:20 +02:00
parent 9c6c08b5ec
commit 31ac3c25d2
7 changed files with 91 additions and 20 deletions

View File

@@ -23,6 +23,14 @@ class ConfigTests(unittest.TestCase):
public = store.update({"graylog_range_seconds": "7200"})
self.assertEqual(public["graylog_range_seconds"], 7200)
def test_graylog_max_events_per_stream_is_numeric_and_bounded(self):
with tempfile.TemporaryDirectory() as directory:
store = ConfigStore(str(Path(directory) / "config.json"))
public = store.update({"graylog_max_events_per_stream": "0"})
self.assertEqual(public["graylog_max_events_per_stream"], 1)
public = store.update({"graylog_max_events_per_stream": "25000"})
self.assertEqual(public["graylog_max_events_per_stream"], 25000)
if __name__ == "__main__":
unittest.main()

View File

@@ -35,6 +35,13 @@ class GraylogSourceTests(unittest.TestCase):
GraylogStreamSource(client, "vpn").fetch(range_seconds=86_400)
self.assertEqual(client.arguments["range_seconds"], 86_400)
def test_marks_stream_truncated_when_max_events_reached(self):
client = _Client()
events, status = GraylogStreamSource(client, "vpn").fetch(max_events=2)
self.assertEqual(len(events), 2)
self.assertEqual(client.arguments["limit"], 2)
self.assertTrue(status["truncated"])
def test_requests_selected_profile_fields(self):
client = _Client()
GraylogStreamSource(client, "windows", profile_fields=("TargetUserName", "EventID")).fetch()