Skip to content

Commit 255cdb8

Browse files
author
Jay
committed
test(agentfield): add regression test for issue #624
Ref: #624 Signed-off-by: Jay <sallomondiei@gmail.com>
1 parent 576bc0c commit 255cdb8

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

tests/test_issue_624.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""Regression test for issue #624 — startup must not probe external IP services."""
2+
3+
import requests
4+
5+
from agentfield import Agent
6+
from agentfield import agent as agent_mod
7+
8+
9+
def test_issue_624(monkeypatch):
10+
"""An explicit Kubernetes callback URL must avoid metadata and ipify probes."""
11+
requests_made = []
12+
13+
class DummyResponse:
14+
status_code = 404
15+
text = ""
16+
17+
def fake_get(url, *args, **kwargs):
18+
requests_made.append(url)
19+
return DummyResponse()
20+
21+
monkeypatch.setattr(agent_mod, "_is_running_in_container", lambda: True)
22+
monkeypatch.setattr(requests, "get", fake_get)
23+
24+
Agent(
25+
node_id="issue-624-agent",
26+
callback_url="http://issue-624-agent.default.svc.cluster.local:8001",
27+
auto_register=False,
28+
enable_did=False,
29+
)
30+
31+
assert requests_made == []

0 commit comments

Comments
 (0)