[tor-commits] [stem/master] Integration test to migrate from client to relay

atagar at torproject.org atagar at torproject.org
Tue Feb 17 16:09:53 UTC 2015


commit 15994b2e6effe8b7637ce4c1244b404048af740b
Author: Sebastian Hahn <sebastian at torproject.org>
Date:   Tue Feb 17 08:08:17 2015 +0100

    Integration test to migrate from client to relay
    
    This helps detect Tor bug 14901.
---
 test/integ/control/controller.py |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 055955d..4fb3806 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -1228,6 +1228,25 @@ class TestController(unittest.TestCase):
       circuits = controller.get_circuits()
       self.assertTrue(new_circ in [circ.id for circ in circuits])
 
+  def test_transition_to_relay(self):
+    """
+    Transitions Tor to turn into a relay, then back to a client.
+    """
+
+    if test.runner.require_control(self):
+      return
+
+    runner = test.runner.get_runner()
+    with runner.get_tor_controller() as controller:
+      self.assertEqual(None, controller.get_conf('OrPort'))
+      # DisableNetwork ensures no port is actually opened
+      controller.set_options({ 'OrPort': '9090', 'DisableNetwork': '1', })
+      # TODO once tor 0.2.7.x exists, test that we can generate a descriptor on demand.
+      self.assertEqual('9090', controller.get_conf('OrPort'))
+      controller.reset_conf('OrPort', 'DisableNetwork')
+      self.assertEqual(None, controller.get_conf('OrPort'))
+
+
   def _get_router_status_entry(self, controller):
     """
     Provides a router status entry for a relay with a nickname other than





More information about the tor-commits mailing list