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

[tor-commits] [stem/master] Revert use of CONF_CHANGED events by test_reattaching_listeners



commit d537fd664203a3a6e665caa061e629416986f589
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed Mar 25 08:45:14 2015 -0700

    Revert use of CONF_CHANGED events by test_reattaching_listeners
    
    Reverting part of the change for #14943 and reopening the ticket since this is
    causing frequent Jenkins failures...
    
      ======================================================================
      FAIL: test_reattaching_listeners
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/runner.py", line 127, in wrapped
          return func(self, *args, **kwargs)
        File "/srv/jenkins-workspace/workspace/stem-tor-ci/test/integ/control/controller.py", line 273, in test_reattaching_listeners
          self.assertTrue(event_notice.wait(10))
      AssertionError: False is not true
    
      ----------------------------------------------------------------------
      Ran 37 tests in 11.423s
    
    Test passes more often that not but at this point the cure is worse than the
    disease, so we should revert until this can be addressed.
---
 test/integ/control/controller.py |   39 ++++++++++++++++----------------------
 1 file changed, 16 insertions(+), 23 deletions(-)

diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 7ce3fdc..5deda2b 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -206,12 +206,13 @@ class TestController(unittest.TestCase):
     runner = test.runner.get_runner()
 
     with runner.get_tor_controller() as controller:
-      controller.add_event_listener(listener, EventType.CONF_CHANGED)
+      controller.add_event_listener(listener, EventType.BW)
 
-      controller.set_conf('NodeFamily', random_fingerprint())
-      self.assertTrue(event_notice.wait(10))
-      self.assertEqual(len(event_buffer), 1)
-      event_notice.clear()
+      # Get a BW event or two. These should be emitted each second but under
+      # heavy system load that's not always the case.
+
+      event_notice.wait(4)
+      self.assertTrue(len(event_buffer) >= 1)
 
       # disconnect and check that we stop getting events
 
@@ -219,26 +220,21 @@ class TestController(unittest.TestCase):
       event_notice.clear()
       event_buffer = []
 
-      # Spawn a second controller and trigger an event
-
-      with runner.get_tor_controller() as controller2:
-        controller2.set_conf('NodeFamily', random_fingerprint())
-
-      self.assertEqual(len(event_buffer), 0)
+      event_notice.wait(2)
+      self.assertTrue(len(event_buffer) == 0)
 
       # reconnect and check that we get events again
 
       controller.connect()
       controller.authenticate(password = test.runner.CONTROL_PASSWORD)
 
-      controller.set_conf('NodeFamily', random_fingerprint())
-      self.assertTrue(event_notice.wait(10))
-      self.assertEqual(len(event_buffer), 1)
-      event_notice.clear()
+      event_notice.wait(4)
+      self.assertTrue(len(event_buffer) >= 1)
 
       # disconnect
 
       controller.close()
+      event_notice.clear()
       event_buffer = []
 
       # reconnect and check that we get events again
@@ -246,14 +242,13 @@ class TestController(unittest.TestCase):
       controller.connect()
       stem.connection.authenticate(controller, password = test.runner.CONTROL_PASSWORD)
 
-      controller.set_conf('NodeFamily', random_fingerprint())
-      self.assertTrue(event_notice.wait(10))
-      self.assertEqual(len(event_buffer), 1)
-      event_notice.clear()
+      event_notice.wait(4)
+      self.assertTrue(len(event_buffer) >= 1)
 
       # disconnect
 
       controller.close()
+      event_notice.clear()
       event_buffer = []
 
       # Reconnect and check that we get events again. This is being done by
@@ -269,10 +264,8 @@ class TestController(unittest.TestCase):
         else:
           controller.msg('AUTHENTICATE')
 
-        controller.set_conf('NodeFamily', random_fingerprint())
-        self.assertTrue(event_notice.wait(10))
-        self.assertEqual(len(event_buffer), 1)
-        event_notice.clear()
+        event_notice.wait(4)
+        self.assertTrue(len(event_buffer) >= 1)
 
   @require_controller
   def test_getinfo(self):

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