add timeout mcp poll

This commit is contained in:
larssand
2026-07-02 21:17:50 +02:00
parent f45c275e20
commit 97d017e43c
5 changed files with 59 additions and 21 deletions

View File

@@ -1,4 +1,5 @@
import unittest
import time
from fgai.graylog_source import GraylogStreamSource
@@ -73,6 +74,14 @@ class GraylogSourceTests(unittest.TestCase):
self.assertTrue(status["partial"])
self.assertIn("graylog_search_error", status["error"])
def test_deadline_stops_raw_fetch_before_search(self):
client = _Client()
events, status = GraylogStreamSource(client, "vpn").fetch(deadline_monotonic=time.monotonic() - 1)
self.assertEqual(events, [])
self.assertTrue(status["partial"])
self.assertEqual(status["error"], "poll_budget_exceeded")
self.assertIsNone(client.arguments)
def test_returns_partial_status_instead_of_raising_on_probe_error(self):
events, status = GraylogStreamSource(_ProbeErrorClient(), "vpn").fetch()
self.assertEqual(events, [])