fix mcp
This commit is contained in:
@@ -20,6 +20,11 @@ class _AggregateClient:
|
||||
return self.responses.pop(0)
|
||||
|
||||
|
||||
class _ProbeErrorClient:
|
||||
def probe(self):
|
||||
raise RuntimeError("connection refused")
|
||||
|
||||
|
||||
class GraylogAggregateTests(unittest.TestCase):
|
||||
def test_reads_count_from_graylog_schema_rows(self):
|
||||
client = _AggregateClient([
|
||||
@@ -33,6 +38,11 @@ class GraylogAggregateTests(unittest.TestCase):
|
||||
self.assertEqual(client.arguments[0]["streams"], ["firewall"])
|
||||
self.assertEqual(client.arguments[0]["metrics"], ["count()"])
|
||||
|
||||
def test_returns_error_status_instead_of_raising_on_probe_error(self):
|
||||
status = GraylogAggregateSource(_ProbeErrorClient(), "firewall").fetch_count()
|
||||
self.assertEqual(status["aggregate_status"], "error")
|
||||
self.assertIn("probe_error", status["aggregate_error"])
|
||||
|
||||
def test_tries_fallback_argument_shape_after_tool_error(self):
|
||||
client = _AggregateClient([
|
||||
{"result": {"isError": True, "content": [{"type": "text", "text": "bad metrics"}]}},
|
||||
|
||||
Reference in New Issue
Block a user