diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-30 17:17:42 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-30 17:17:42 +0100 |
| commit | cec2a3b6a2c1522de43c6f50c211aca508d6ed53 (patch) | |
| tree | 50332c22435598e6339ec4cb1bb195f271cafbe4 /tests/integration/test_expiry.py | |
| parent | e8025048ec439da14f3edc4837ca188f0833fc1a (diff) | |
Fix idle tests in presence of an accept filter
Diffstat (limited to 'tests/integration/test_expiry.py')
| -rw-r--r-- | tests/integration/test_expiry.py | 7 |
1 files changed, 6 insertions, 1 deletions
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): | |||
| 27 | def test_the_sweep_takes_the_idle_and_leaves_the_answered(self): | 27 | def test_the_sweep_takes_the_idle_and_leaves_the_answered(self): |
| 28 | idle = socket.create_connection(("127.0.0.1", self.tracker.port), timeout=5) | 28 | idle = socket.create_connection(("127.0.0.1", self.tracker.port), timeout=5) |
| 29 | try: | 29 | try: |
| 30 | # Enough for a kernel that holds a connection back until data | ||
| 31 | # arrives to hand it over, and far too little to be answered, so | ||
| 32 | # the tracker has accepted it and is waiting for the rest | ||
| 33 | idle.sendall(b"GET /ann") | ||
| 34 | |||
| 30 | self.assertEqual(self.tracker.announce(self.hash_for("expiry-sweep"))[b"complete"], 1) | 35 | self.assertEqual(self.tracker.announce(self.hash_for("expiry-sweep"))[b"complete"], 1) |
| 31 | 36 | ||
| 32 | time.sleep(CLIENT_TIMEOUT + 3 * CHECK_INTERVAL) | 37 | time.sleep(CLIENT_TIMEOUT + 3 * CHECK_INTERVAL) |
| @@ -34,6 +39,6 @@ class ExpirySweep(TrackerTestCase): | |||
| 34 | self.assertEqual(self.tracker.torrent_count(), 1, "the tracker stopped serving while sweeping") | 39 | self.assertEqual(self.tracker.torrent_count(), 1, "the tracker stopped serving while sweeping") |
| 35 | 40 | ||
| 36 | idle.settimeout(5) | 41 | idle.settimeout(5) |
| 37 | self.assertEqual(idle.recv(64), b"", "a connection that never sent a request was not swept") | 42 | self.assertEqual(idle.recv(64), b"", "a connection that went quiet mid-request was not swept") |
| 38 | finally: | 43 | finally: |
| 39 | idle.close() | 44 | idle.close() |
