commit 50a5e9a3bcdf07a099eeb0bc28442c827a1d91ff Author: Damian Johnson atagar@torproject.org Date: Fri Jul 31 18:22:44 2020 -0700
Fix test_authenticate_general_example
This test failed when running with a control socket (the RUN_SOCKET test target) because our constructor no longer implicity connects. Fixing this tests' "am I using a control port" check.
The test failure message was...
====================================================================== FAIL: test_authenticate_general_example ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/atagar/Desktop/stem/stem/socket.py", line 456, in _open_connection return await asyncio.open_connection(self.address, self.port) File "/home/atagar/Python-3.7.0/Lib/asyncio/streams.py", line 77, in open_connection lambda: protocol, host, port, **kwds) File "/home/atagar/Python-3.7.0/Lib/asyncio/base_events.py", line 943, in create_connection raise exceptions[0] File "/home/atagar/Python-3.7.0/Lib/asyncio/base_events.py", line 930, in create_connection await self.sock_connect(sock, address) ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 1111)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/atagar/Desktop/stem/stem/connection.py", line 583, in authenticate protocolinfo_response = await get_protocolinfo(controller) File "/home/atagar/Desktop/stem/stem/connection.py", line 1077, in get_protocolinfo await controller.connect() File "/home/atagar/Desktop/stem/stem/socket.py", line 182, in connect self._reader, self._writer = await self._open_connection() File "/home/atagar/Desktop/stem/stem/socket.py", line 458, in _open_connection raise stem.SocketError(exc) stem.SocketError: [Errno 111] Connect call failed ('127.0.0.1', 1111)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/integ/connection/authentication.py", line 146, in test_authenticate_general_example await stem.connection.authenticate(control_socket, chroot_path = runner.get_chroot()) File "/home/atagar/Desktop/stem/stem/connection.py", line 587, in authenticate raise AuthenticationFailure('socket connection failed (%s)' % exc) stem.connection.AuthenticationFailure: socket connection failed ([Errno 111] Connect call failed ('127.0.0.1', 1111))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/atagar/Desktop/stem/test/require.py", line 75, in wrapped return func(self, *args, **kwargs) File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 701, in wrapper result = loop.run_until_complete(func(*args, **kwargs)) File "/home/atagar/Python-3.7.0/Lib/asyncio/base_events.py", line 568, in run_until_complete return future.result() File "/home/atagar/Desktop/stem/test/integ/connection/authentication.py", line 160, in test_authenticate_general_example self.fail() AssertionError: None
---------------------------------------------------------------------- --- test/integ/connection/authentication.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/test/integ/connection/authentication.py b/test/integ/connection/authentication.py index 606f0c1d..6851e29d 100644 --- a/test/integ/connection/authentication.py +++ b/test/integ/connection/authentication.py @@ -136,6 +136,7 @@ class TestAuthenticate(unittest.TestCase):
try: control_socket = stem.socket.ControlPort(port = test.runner.CONTROL_PORT) + await control_socket.connect() except stem.SocketError: # assert that we didn't have a socket to connect to self.assertFalse(test.runner.Torrc.PORT in tor_options)