[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Replace SocksListenAddress with SocksPort in tests



commit e35286dd97c49c9741497fae9cc544247a6d3c9f
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed May 10 11:14:26 2017 -0700

    Replace SocksListenAddress with SocksPort in tests
    
    Tor deprecated its SocksListenAddress option a while ago and has now dropped
    it, causing some integ tests to fail. Accounting for this.
    
    The option's deprecation was noted in the maual and logs but our tests don't
    present those so didn't spot the upcoming deprecation. Oops. :P
---
 test/integ/control/controller.py | 6 +++---
 test/integ/process.py            | 2 +-
 test/runner.py                   | 5 ++---
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 895d435..2445221 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -435,10 +435,10 @@ class TestController(unittest.TestCase):
       custom_options = controller._get_custom_options()
       self.assertTrue('ControlPort' in custom_options or 'ControlSocket' in custom_options)
       self.assertEqual('1', custom_options['DownloadExtraInfo'])
-      self.assertEqual('127.0.0.1:1112', custom_options['SocksListenAddress'])
+      self.assertEqual('1112', custom_options['SocksPort'])
 
       self.assertTrue(controller.is_set('DownloadExtraInfo'))
-      self.assertTrue(controller.is_set('SocksListenAddress'))
+      self.assertTrue(controller.is_set('SocksPort'))
       self.assertFalse(controller.is_set('CellStatistics'))
       self.assertFalse(controller.is_set('ConnLimit'))
 
@@ -1070,7 +1070,7 @@ class TestController(unittest.TestCase):
         try:
           s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
           s.settimeout(30)
-          s.connect(('127.0.0.1', int(controller.get_conf('SocksListenAddress').rsplit(':', 1)[1])))
+          s.connect(('127.0.0.1', int(controller.get_conf('SocksPort'))))
           test.network.negotiate_socks(s, '1.2.1.2', 80)
           s.sendall(stem.util.str_tools._to_bytes(test.network.ip_request))  # make the http request for the ip address
           response = s.recv(1000)
diff --git a/test/integ/process.py b/test/integ/process.py
index b81a3bf..79797ac 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -306,7 +306,7 @@ class TestProcess(unittest.TestCase):
       t.start()
       t.join()
 
-      if 'Invalid SocksPort/SocksListenAddress' in str(raised_exc[0]):
+      if 'Invalid SocksPort' in str(raised_exc[0]):
         return None  # got to the point of invoking tor
       else:
         return raised_exc[0]
diff --git a/test/runner.py b/test/runner.py
index a494b65..69af65d 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -58,16 +58,15 @@ CONFIG = stem.util.conf.config_dict('test', {
   'integ.log': './test/data/log',
 })
 
-SOCKS_HOST = '127.0.0.1'
 SOCKS_PORT = 1112
 
 BASE_TORRC = """# configuration for stem integration tests
 DataDirectory %%s
-SocksListenAddress %s:%i
+SocksPort %i
 DownloadExtraInfo 1
 Log notice stdout
 Log notice file %%s/tor_log
-""" % (SOCKS_HOST, SOCKS_PORT)
+""" % SOCKS_PORT
 
 # singleton Runner instance
 INTEG_RUNNER = None

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits