Fix Server release checks for the LAN-only listener [skip ci]
This commit is contained in:
@@ -53,3 +53,21 @@ def test_release_rejects_unsafe_runtime(release_tool, monkeypatch, unsafe):
|
||||
monkeypatch.setattr(release_tool, "inspect", lambda: container)
|
||||
with pytest.raises(AssertionError):
|
||||
release_tool.verify_runtime("test")
|
||||
|
||||
|
||||
def test_release_readiness_retries_on_actual_listener(release_tool, monkeypatch):
|
||||
import io
|
||||
import urllib.error
|
||||
|
||||
calls = []
|
||||
|
||||
def listener(url, timeout):
|
||||
calls.append(url)
|
||||
if url != "http://192.0.2.10:81/ready" or len(calls) == 1:
|
||||
raise urllib.error.URLError("Connection refused during restart")
|
||||
return io.BytesIO(b'{"status":"ready"}')
|
||||
|
||||
monkeypatch.setattr(release_tool.urllib.request, "urlopen", listener)
|
||||
monkeypatch.setattr(release_tool.time, "sleep", lambda _: None)
|
||||
release_tool.wait_ready()
|
||||
assert len(calls) == 2
|
||||
|
||||
Reference in New Issue
Block a user