summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-27 03:24:12 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-10-27 03:24:12 +0100
commit06b7c31e25ea355946814da03749ae197c68d969 (patch)
tree26b571432ed361f18ceccec6a17dead73075c7a0 /tests
parent8c22d577fe1bf1f5c66c82c32854bdcd9ed1b3ee (diff)
Fix some tests to match retired stats modes and wrong config file ordering
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_stats.py15
-rw-r--r--tests/integration/test_udp.py15
2 files changed, 22 insertions, 8 deletions
diff --git a/tests/integration/test_stats.py b/tests/integration/test_stats.py
index 7ff9a38..820b917 100644
--- a/tests/integration/test_stats.py
+++ b/tests/integration/test_stats.py
@@ -16,8 +16,7 @@ from harness import TrackerTestCase
16 16
17# The modes a default build answers. "tpbs" and "statedump" are full scrapes 17# The modes a default build answers. "tpbs" and "statedump" are full scrapes
18# and belong to test_fullscrape; "fulllog" and "woodpeckers" sit behind 18# and belong to test_fullscrape; "fulllog" and "woodpeckers" sit behind
19# feature flags this build does not set; "busy" is advertised but unbuilt, 19# feature flags this build does not set.
20# which the next case pins.
21MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] 20MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"]
22TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew", "version"] 21TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew", "version"]
23 22
@@ -36,14 +35,14 @@ class StatsShape(TrackerTestCase):
36 for line in lines[:2]: 35 for line in lines[:2]:
37 self.assertRegex(line, rb"^\d+$", "mode %s line %r" % (mode, line)) 36 self.assertRegex(line, rb"^\d+$", "mode %s line %r" % (mode, line))
38 37
39 def test_the_busy_mode_is_advertised_but_not_built(self): 38 def test_the_busy_mode_is_gone(self):
40 """TASK_STATS_BUSY_NETWORKS is in the enum and in the mode table, and 39 """It was listed in the mode table and implemented nowhere, so it only
41 no switch anywhere handles it, so the worker frees the empty answer 40 ever answered 500. Removed rather than written: picking poisoning
42 and the request ends as a server error. Pinned rather than blessed: 41 networks out stopped being meaningful once consumer lines became bot
43 either the report gets written or the mode leaves the table.""" 42 hosts and v6 made the address space too large to watch."""
44 with self.assertRaises(urllib.error.HTTPError) as caught: 43 with self.assertRaises(urllib.error.HTTPError) as caught:
45 self.tracker.stats("busy") 44 self.tracker.stats("busy")
46 self.assertEqual(caught.exception.code, 500) 45 self.assertEqual(caught.exception.code, 400, "an unknown mode, like any other")
47 46
48 def test_an_unknown_mode_is_refused(self): 47 def test_an_unknown_mode_is_refused(self):
49 with self.assertRaises(urllib.error.HTTPError) as caught: 48 with self.assertRaises(urllib.error.HTTPError) as caught:
diff --git a/tests/integration/test_udp.py b/tests/integration/test_udp.py
index 1dfa21b..1cb2389 100644
--- a/tests/integration/test_udp.py
+++ b/tests/integration/test_udp.py
@@ -149,5 +149,20 @@ class UdpScrape(TrackerTestCase):
149 sock.close() 149 sock.close()
150 150
151 151
152class UdpWorkersConfiguredAfterTheListener(TrackerTestCase):
153 """The harness writes its listen lines first, so this directive lands
154 below them: the position a config file should not care about."""
155
156 config = "listen.udp.workers 4\n"
157
158 def test_the_tracker_starts_and_still_answers_udp(self):
159 sock, connection_id = self.tracker.udp_connect()
160 try:
161 answer = self.tracker.udp_announce(sock, connection_id, self.hash_for("udpworkers"), left=0)
162 self.assertEqual(answer["seeders"], 1)
163 finally:
164 sock.close()
165
166
152if __name__ == "__main__": 167if __name__ == "__main__":
153 unittest.main() 168 unittest.main()