From cec2a3b6a2c1522de43c6f50c211aca508d6ed53 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 30 Oct 2026 17:17:42 +0100 Subject: Fix idle tests in presence of an accept filter --- tests/integration/test_expiry.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/integration/test_expiry.py') diff --git a/tests/integration/test_expiry.py b/tests/integration/test_expiry.py index 5a21e57..5e6dc0a 100644 --- a/tests/integration/test_expiry.py +++ b/tests/integration/test_expiry.py @@ -27,6 +27,11 @@ class ExpirySweep(TrackerTestCase): def test_the_sweep_takes_the_idle_and_leaves_the_answered(self): idle = socket.create_connection(("127.0.0.1", self.tracker.port), timeout=5) try: + # Enough for a kernel that holds a connection back until data + # arrives to hand it over, and far too little to be answered, so + # the tracker has accepted it and is waiting for the rest + idle.sendall(b"GET /ann") + self.assertEqual(self.tracker.announce(self.hash_for("expiry-sweep"))[b"complete"], 1) time.sleep(CLIENT_TIMEOUT + 3 * CHECK_INTERVAL) @@ -34,6 +39,6 @@ class ExpirySweep(TrackerTestCase): self.assertEqual(self.tracker.torrent_count(), 1, "the tracker stopped serving while sweeping") idle.settimeout(5) - self.assertEqual(idle.recv(64), b"", "a connection that never sent a request was not swept") + self.assertEqual(idle.recv(64), b"", "a connection that went quiet mid-request was not swept") finally: idle.close() -- cgit v1.3