fix group agg

This commit is contained in:
larssand
2026-06-30 12:27:16 +02:00
parent e144cd8258
commit 4f968eeed5
4 changed files with 18 additions and 48 deletions

View File

@@ -45,6 +45,20 @@ class GraylogAggregateTests(unittest.TestCase):
self.assertEqual(status["aggregate_events"], 42)
self.assertEqual(len(client.arguments), 2)
def test_fallbacks_only_use_graylog_supported_aggregate_fields(self):
client = _AggregateClient([
{"result": {"isError": True, "content": [{"type": "text", "text": "bad count parens"}]}},
{"result": {"isError": True, "content": [{"type": "text", "text": "bad count"}]}},
{"result": {"isError": True, "content": [{"type": "text", "text": "bad object metric"}]}},
])
status = GraylogAggregateSource(client, "firewall").fetch_count()
self.assertEqual(status["aggregate_status"], "error")
self.assertEqual(len(client.arguments), 3)
for arguments in client.arguments:
self.assertEqual(set(arguments), {"query", "streams", "range_seconds", "groupings", "metrics"})
def test_uses_tool_schema_to_avoid_unsupported_fields(self):
schema = {"properties": {"query": {}, "streams": {}, "range_seconds": {}, "metrics": {}, "groupings": {}}}
client = _AggregateClient([