diff options
| -rw-r--r-- | tests/integration/test_stats.py | 15 | ||||
| -rw-r--r-- | tests/integration/test_udp.py | 15 |
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. | ||
| 21 | MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] | 20 | MRTG_MODES = ["peer", "conn", "scrp", "udp4", "tcp4", "torr", "fscr", "completed", "syncs"] |
| 22 | TEXT_MODES = ["herr", "s24s", "top10", "top100", "renew", "version"] | 21 | TEXT_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 | ||
| 152 | class 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 | |||
| 152 | if __name__ == "__main__": | 167 | if __name__ == "__main__": |
| 153 | unittest.main() | 168 | unittest.main() |
