[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Drop test_attachstream retries
commit 637b388c94a414eead76e499f2471768c1d8f0cc
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Tue Jul 21 15:41:53 2020 -0700
Drop test_attachstream retries
Our test_attachstream test attempted to establish a connection ten times, but
in the dozen attempts I just ran it always works on its first try.
---
test/integ/control/controller.py | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py
index 6ed89d2b..b539fc0e 100644
--- a/test/integ/control/controller.py
+++ b/test/integ/control/controller.py
@@ -1533,31 +1533,26 @@ class TestController(unittest.TestCase):
async with await test.runner.get_runner().get_tor_controller() as controller:
# try 10 times to build a circuit we can connect through
- for i in range(10):
- await controller.add_event_listener(handle_streamcreated, stem.control.EventType.STREAM)
- await controller.set_conf('__LeaveStreamsUnattached', '1')
+ await controller.add_event_listener(handle_streamcreated, stem.control.EventType.STREAM)
+ await controller.set_conf('__LeaveStreamsUnattached', '1')
- try:
- circuit_id = await controller.new_circuit(await_build = True)
- socks_listener = (await controller.get_listeners(Listener.SOCKS))[0]
-
- with test.network.Socks(socks_listener) as s:
- s.settimeout(5)
+ try:
+ circuit_id = await controller.new_circuit(await_build = True)
+ socks_listener = (await controller.get_listeners(Listener.SOCKS))[0]
- t = threading.Thread(target = s.connect, args = ((host, port),))
- t.start()
+ with test.network.Socks(socks_listener) as s:
+ s.settimeout(5)
- await asyncio.wait_for(stream_attached.wait(), timeout = 6)
- streams = await controller.get_streams()
+ t = threading.Thread(target = s.connect, args = ((host, port),))
+ t.start()
- t.join()
+ await asyncio.wait_for(stream_attached.wait(), timeout = 6)
+ streams = await controller.get_streams()
- break
- except (stem.CircuitExtensionFailed, socket.timeout):
- continue
- finally:
- await controller.remove_event_listener(handle_streamcreated)
- await controller.reset_conf('__LeaveStreamsUnattached')
+ t.join()
+ finally:
+ await controller.remove_event_listener(handle_streamcreated)
+ await controller.reset_conf('__LeaveStreamsUnattached')
our_stream = [stream for stream in streams if stream.target_address == host][0]
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits