fix desktop tests
docker / image (push) Failing after 5s
lint / ruff (push) Successful in 15s
tests / backend (push) Successful in 1m42s
tests / desktop (push) Successful in 24s
tests / web (push) Successful in 39s
tests / android-core (push) Successful in 39s
android / apk (push) Failing after 5m0s
docker / image (push) Failing after 5s
lint / ruff (push) Successful in 15s
tests / backend (push) Successful in 1m42s
tests / desktop (push) Successful in 24s
tests / web (push) Successful in 39s
tests / android-core (push) Successful in 39s
android / apk (push) Failing after 5m0s
This commit is contained in:
1 file changed
+8
-3
@@ -231,11 +231,16 @@ def test_junk_on_the_socket_does_not_take_the_stub_down(stub):
|
|||||||
|
|
||||||
|
|
||||||
def test_a_dead_upstream_becomes_servfail(tmp_path):
|
def test_a_dead_upstream_becomes_servfail(tmp_path):
|
||||||
resolver = StubResolver(ports=(0,), upstream_path=str(tmp_path / "empty.conf"), timeout=0.3)
|
# A socket that is bound and listening but never answers. The upstream must
|
||||||
|
# be named explicitly: an empty or missing file falls back to the machine's
|
||||||
|
# /etc/resolv.conf, which in CI is Docker's resolver and *does* answer.
|
||||||
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as dead:
|
||||||
|
dead.bind(("127.0.0.1", 0))
|
||||||
|
conf = tmp_path / "resolv.conf"
|
||||||
|
conf.write_text(f"nameserver 127.0.0.1:{dead.getsockname()[1]}\n")
|
||||||
|
resolver = StubResolver(ports=(0,), upstream_path=str(conf), timeout=0.3)
|
||||||
assert resolver.start()
|
assert resolver.start()
|
||||||
try:
|
try:
|
||||||
# The file does not exist and /etc/resolv.conf points at resolved, which
|
|
||||||
# is filtered out — so there is nowhere to forward to.
|
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
|
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
|
||||||
sock.settimeout(2)
|
sock.settimeout(2)
|
||||||
sock.sendto(query("example.com"), ("127.0.0.1", resolver.port))
|
sock.sendto(query("example.com"), ("127.0.0.1", resolver.port))
|
||||||
|
|||||||
Reference in new issue
Block a user