add timeout mcp poll
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import unittest
|
||||
import time
|
||||
|
||||
from fgai.graylog_aggregate import GraylogAggregateSource
|
||||
|
||||
@@ -92,6 +93,17 @@ class GraylogAggregateTests(unittest.TestCase):
|
||||
self.assertIn("groupings", client.arguments[0])
|
||||
self.assertNotIn("group_by", client.arguments[0])
|
||||
|
||||
def test_deadline_stops_aggregate_attempts(self):
|
||||
client = _AggregateClient([
|
||||
{"result": {"content": [{"type": "text", "text": '{"events": 9}'}]}}
|
||||
])
|
||||
|
||||
status = GraylogAggregateSource(client, "firewall").fetch_count(deadline_monotonic=time.monotonic() - 1)
|
||||
|
||||
self.assertEqual(status["aggregate_status"], "error")
|
||||
self.assertIn("poll_budget_exceeded", status["aggregate_error"])
|
||||
self.assertEqual(client.arguments, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user