[tor-commits] [stem/master] Don't cache testing check for multiple tor instances

atagar at torproject.org atagar at torproject.org
Wed Jan 14 17:25:45 UTC 2015


commit 92dd46485385fec75699250d2c67d961bf188c2c
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jan 14 09:23:39 2015 -0800

    Don't cache testing check for multiple tor instances
    
    Our system module has integ tests that can't work if there's multiple tor
    instances running at a given time. We skip these tests if that's the case, but
    we only check once then cache the results.
    
    Recently our Jenkins tests have started failing. They vary in when they fail so
    my guess is that we have something new on the host kicking off tor processes.
    No surprise - we run Stem's integ tests when someone pushes to tor, and that's
    no doubt the same hook used for others.
    
    Fixing by simply not caching the check.
---
 test/integ/util/system.py |   30 +++++++++++-------------------
 1 file changed, 11 insertions(+), 19 deletions(-)

diff --git a/test/integ/util/system.py b/test/integ/util/system.py
index beea501..1ffe7cd 100644
--- a/test/integ/util/system.py
+++ b/test/integ/util/system.py
@@ -19,9 +19,6 @@ except ImportError:
   from mock import Mock, patch
 
 
-IS_EXTRA_TOR_RUNNING = None
-
-
 def filter_system_call(prefixes):
   """
   Provides a functor that passes calls on to the stem.util.system.call()
@@ -560,19 +557,14 @@ class TestSystem(unittest.TestCase):
     # isn't the end of the world. It's just used to skip tests if they should
     # legitemately fail.
 
-    global IS_EXTRA_TOR_RUNNING
-
-    if IS_EXTRA_TOR_RUNNING is None:
-      if stem.util.system.is_windows():
-        # TODO: not sure how to check for this on windows
-        IS_EXTRA_TOR_RUNNING = False
-      elif not stem.util.system.is_bsd():
-        tor_cmd = test.runner.get_runner().get_tor_command(True)
-        pgrep_results = stem.util.system.call(stem.util.system.GET_PID_BY_NAME_PGREP % tor_cmd)
-        IS_EXTRA_TOR_RUNNING = len(pgrep_results) > 1
-      else:
-        ps_results = stem.util.system.call(stem.util.system.GET_PID_BY_NAME_PS_BSD)
-        results = [r for r in ps_results if r.endswith(' tor')]
-        IS_EXTRA_TOR_RUNNING = len(results) > 1
-
-    return IS_EXTRA_TOR_RUNNING
+    if stem.util.system.is_windows():
+      # TODO: not sure how to check for this on windows
+      return False
+    elif not stem.util.system.is_bsd():
+      tor_cmd = test.runner.get_runner().get_tor_command(True)
+      pgrep_results = stem.util.system.call(stem.util.system.GET_PID_BY_NAME_PGREP % tor_cmd)
+      return len(pgrep_results) > 1
+    else:
+      ps_results = stem.util.system.call(stem.util.system.GET_PID_BY_NAME_PS_BSD)
+      results = [r for r in ps_results if r.endswith(' tor')]
+      return len(results) > 1



More information about the tor-commits mailing list