[tor-commits] [stem/master] Testing failures due to static fingerprints

atagar at torproject.org atagar at torproject.org
Tue May 23 23:40:45 UTC 2017


commit a9af1b665b2aa85de6ecdc4011f6935fd0299804
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue May 23 14:13:06 2017 -0700

    Testing failures due to static fingerprints
    
    Oops, dropping the random_fingerprint() helper caused a couple test failures
    that didn't show up on my laptop. When calling SETCONF we need the fingerprints
    to be different (though randomness doesn't matter) so events are triggered.
---
 test/integ/control/base_controller.py | 5 ++++-
 test/integ/control/controller.py      | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/test/integ/control/base_controller.py b/test/integ/control/base_controller.py
index 9f2fc44..294eaee 100644
--- a/test/integ/control/base_controller.py
+++ b/test/integ/control/base_controller.py
@@ -2,6 +2,8 @@
 Integration tests for the stem.control.BaseController class.
 """
 
+import os
+import hashlib
 import re
 import threading
 import time
@@ -151,7 +153,8 @@ class TestBaseController(unittest.TestCase):
       controller.msg('SETEVENTS CONF_CHANGED')
 
       for i in range(10):
-        controller.msg('SETCONF NodeFamily=FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
+        fingerprint = hashlib.sha1(os.urandom(20)).hexdigest().upper()
+        controller.msg('SETCONF NodeFamily=%s' % fingerprint)
         test.runner.exercise_controller(self, controller)
 
       controller.msg('SETEVENTS')
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 1e4e8e8..889ca0c 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -159,7 +159,7 @@ class TestController(unittest.TestCase):
 
       buffer2_size = len(event_buffer2)
 
-      controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
+      controller.set_conf('NodeFamily', 'A82F7EFDB570F6BC801805D0328D30A99403C401')
       event_notice1.wait(10)
       self.assertEqual(len(event_buffer1), 2)
       event_notice1.clear()
@@ -209,7 +209,7 @@ class TestController(unittest.TestCase):
       controller.connect()
       controller.authenticate(password = test.runner.CONTROL_PASSWORD)
       self.assertTrue(len(event_buffer) == 0)
-      controller.set_conf('NodeFamily', 'FD4CC275C5AA4D27A487C6CA29097900F85E2C33')
+      controller.set_conf('NodeFamily', 'A82F7EFDB570F6BC801805D0328D30A99403C401')
 
       event_notice.wait(4)
       self.assertTrue(len(event_buffer) >= 1)





More information about the tor-commits mailing list