diff options
| -rw-r--r-- | tests/integration/test_config.py | 29 |
1 files changed, 29 insertions, 0 deletions
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 @@ | |||
| 1 | """Settings the tracker has to accept, and still work with. | ||
| 2 | |||
| 3 | An unrecognised key makes opentracker refuse to start, so a test that it | ||
| 4 | comes up at all is a test that the key was understood. | ||
| 5 | """ | ||
| 6 | |||
| 7 | import unittest | ||
| 8 | |||
| 9 | from harness import Tracker, TrackerTestCase, free_port | ||
| 10 | |||
| 11 | |||
| 12 | class TcpWorkers(TrackerTestCase): | ||
| 13 | config = "listen.tcp.workers 2\n" | ||
| 14 | |||
| 15 | def test_the_tracker_serves_with_tcp_workers_asked_for(self): | ||
| 16 | self.assertEqual(self.tracker.announce(self.hash_for("tcpworkers"))[b"complete"], 1) | ||
| 17 | |||
| 18 | |||
| 19 | class WorkersOnAListenStatement(unittest.TestCase): | ||
| 20 | def test_a_listen_statement_may_carry_a_worker_count(self): | ||
| 21 | """The option is read off the statement rather than inherited.""" | ||
| 22 | second = free_port() | ||
| 23 | tracker = Tracker("listen.tcp 127.0.0.1:%d workers=2\n" % second) | ||
| 24 | try: | ||
| 25 | self.assertEqual(tracker.announce(b"listenopts\0\0\0\0\0\0\0\0\0\0")[b"complete"], 1) | ||
| 26 | complaints = tracker.stop() | ||
| 27 | self.assertEqual(complaints, [], "the tracker reported:\n" + "\n".join(complaints)) | ||
| 28 | finally: | ||
| 29 | tracker._cleanup() | ||
