[tor-commits] [stem/master] Removing GETINFO version queries from integ tests

atagar at torproject.org atagar at torproject.org
Fri May 18 15:43:04 UTC 2012


commit aed91aa634b9f960e87296b9e631a2c6aa05f2c0
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri May 18 08:33:13 2012 -0700

    Removing GETINFO version queries from integ tests
    
    Sathyanarayanan spotted a couple points in our integ tests where we make
    'GETINFO version' queries, then compare against the parsed tor version. This
    es no bueno because the parsed version just contains what, according to the
    version-spec, is the version and the getinfo query includes extra data like
    the git commit id it came from.
    
    This is actually an issue we encountered before and was fixed. However, since
    then these queries slipped back into new tests since they seem like an easy
    way of exercising a socket. Oops. :)
    
    Tested by checking out the git commit that gsathya is using (ef0bc7f), then
    running stem's integ tests against that.
    
    This fixes ticket 5918 and might address 5917 too (I'm not sure why the later
    is hanging - that's not happening for me though the test did have an error).
---
 test/integ/control/base_controller.py |    8 ++------
 test/integ/process.py                 |    6 +++---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/test/integ/control/base_controller.py b/test/integ/control/base_controller.py
index 4a8033a..09c68da 100644
--- a/test/integ/control/base_controller.py
+++ b/test/integ/control/base_controller.py
@@ -75,13 +75,9 @@ class TestBaseController(unittest.TestCase):
     Tests a basic query with the msg() method.
     """
     
-    runner = test.runner.get_runner()
-    with runner.get_tor_socket() as control_socket:
+    with test.runner.get_runner().get_tor_socket() as control_socket:
       controller = stem.control.BaseController(control_socket)
-      response = controller.msg("GETINFO version")
-      
-      tor_version = runner.get_tor_version()
-      self.assertEquals("version=%s\nOK" % tor_version, str(response))
+      test.runner.exercise_controller(self, controller)
   
   def test_msg_invalid(self):
     """
diff --git a/test/integ/process.py b/test/integ/process.py
index b03fb27..f189f46 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -39,9 +39,9 @@ class TestProcess(unittest.TestCase):
       stem.connection.authenticate(control_socket, chroot_path = runner.get_chroot())
       
       # exercises the socket
-      control_socket.send("GETINFO version")
-      version_response = control_socket.recv()
-      self.assertEquals("version=%s\nOK" % runner.get_tor_version(), str(version_response))
+      control_socket.send("GETCONF ControlPort")
+      getconf_response = control_socket.recv()
+      self.assertEquals("ControlPort=2778", str(getconf_response))
     finally:
       if control_socket: control_socket.close()
       tor_process.kill()



More information about the tor-commits mailing list