[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Integ test for when spawning a tor process fails
commit e006b5660eab77679939f6cbe329a71dbc3bed34
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Feb 1 13:23:37 2015 -0800
Integ test for when spawning a tor process fails
Spotted that we're missing a test for this while looking into an issue where we
possibly leave lingering tor processes...
https://trac.torproject.org/projects/tor/ticket/14419
---
test/integ/process.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/test/integ/process.py b/test/integ/process.py
index bd080b6..163fd2b 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -67,6 +67,32 @@ class TestProcess(unittest.TestCase):
tor_process.kill()
tor_process.wait()
+ def test_with_invalid_config(self):
+ """
+ Spawn a tor process with a configuration that should make it dead on arrival.
+ """
+
+ if test.runner.only_run_once(self, 'test_with_invalid_config'):
+ return
+
+ # Set the same SocksPort and ControlPort, this should fail with...
+ #
+ # [warn] Failed to parse/validate config: Failed to bind one of the listener ports.
+ # [err] Reading config failed--see warnings above.
+
+ try:
+ stem.process.launch_tor_with_config(
+ tor_cmd = test.runner.get_runner().get_tor_command(),
+ config = {
+ 'SocksPort': '2777',
+ 'ControlPort': '2777',
+ 'DataDirectory': self.data_directory,
+ },
+ )
+ self.fail("We should abort when there's an identical SocksPort and ControlPort")
+ except OSError as exc:
+ self.assertEqual('Process terminated: Failed to bind one of the listener ports.', str(exc))
+
def test_launch_tor_with_timeout(self):
"""
Runs launch_tor where it times out before completing.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits