From 9a2d71c69518a0448940b8873051ac3a2ee37999 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sat, 31 Oct 2026 00:30:31 +0100 Subject: Add test for new config params --- tests/integration/test_config.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/integration/test_config.py diff --git a/tests/integration/test_config.py b/tests/integration/test_config.py new file mode 100644 index 0000000..1a84fa7 --- /dev/null +++ b/tests/integration/test_config.py @@ -0,0 +1,29 @@ +"""Settings the tracker has to accept, and still work with. + +An unrecognised key makes opentracker refuse to start, so a test that it +comes up at all is a test that the key was understood. +""" + +import unittest + +from harness import Tracker, TrackerTestCase, free_port + + +class TcpWorkers(TrackerTestCase): + config = "listen.tcp.workers 2\n" + + def test_the_tracker_serves_with_tcp_workers_asked_for(self): + self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1) + + +class WorkersOnAListenStatement(unittest.TestCase): + def test_a_listen_statement_may_carry_a_worker_count(self): + """The option is read off the statement rather than inherited.""" + second = free_port() + tracker = Tracker("listen.tcp 127.0.0.1:%d workers=2\n" % second) + try: + self.assertEqual(tracker.announce(b"listenopts\0\0\0\0\0\0\0\0\0\0")[b"complete"], 1) + complaints = tracker.stop() + self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints)) + finally: + tracker._cleanup() -- cgit v1.3