Opened 5 years ago

Closed 4 years ago

#8692 closed defect (fixed)

ONLINE integ target fails

Reported by: atagar Owned by: atagar
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: testing easy
Cc: saturn5971@… Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

We rarely run the ONLINE integration target so, no surprise, it fails...

======================================================================
ERROR: test_attachstream
----------------------------------------------------------------------
Traceback:
  File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 974, in test_attachstream
    circuit_id = controller.new_circuit(await_build = True)
  File "/home/atagar/Desktop/stem/stem/control.py", line 1781, in new_circuit
    return self.extend_circuit('0', path, purpose, await_build)
  File "/home/atagar/Desktop/stem/stem/control.py", line 1874, in extend_circuit
    raise stem.CircuitExtensionFailed("Circuit failed to be created: %s" % circ.reason, circ)
CircuitExtensionFailed: Circuit failed to be created: TIMEOUT

======================================================================
ERROR: test_mapaddress
----------------------------------------------------------------------
Traceback:
  File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 791, in test_mapaddress
    test.util.negotiate_socks(s, '1.2.1.2', 80)
  File "/home/atagar/Desktop/stem/test/util.py", line 78, in negotiate_socks
    raise ProtocolError(error_msgs.get(response[1], "SOCKS server returned unrecognized error code"))
ProtocolError: SOCKS server returned unrecognized error code

======================================================================
FAIL: test_close_stream
----------------------------------------------------------------------
Traceback:
  File "/home/atagar/Desktop/stem/test/integ/control/controller.py", line 769, in test_close_stream
    self.assertEqual([built_stream.id], [stream.id for stream in controller.get_streams()])
AssertionError: Lists differ: ['34'] != ['34', '13', '530']

Second list contains 2 additional elements.
First extra element 1:
13

- ['34']
+ ['34', '13', '530']

----------------------------------------------------------------------
Ran 31 tests in 28.013s

FAILED

The ONLINE tests tend to be the flakiest since they rely on network resources. We should see if we can shore them up.

Child Tickets

Change History (4)

comment:1 Changed 5 years ago by atagar

Keywords: testing easy added

comment:2 Changed 4 years ago by saturn597

Cc: saturn5971@… added
Status: newneeds_review

Here's a patch that might help:

https://github.com/saturn597/stem/commit/a6ee8821597f9c615b32965d87b9d108d94debbb

I modified test_attachstream and test_mapaddress to repeat their network-reliant parts a few times if they fail, in order to rule out the possibility that we're failing only due to temporary network issues. I also changed the strategy in attachstream a bit so that it doesn't depend on checking our IP address to determine whether we attached to the right circuit, since sometimes the address Tor reports for an exit is different from what it actually turns out to be.

With these changes, the online target fails pretty rarely, though I still get exceptions due to test_closestream having streams open at the end. The extra streams I've seen are for a DIR_FETCH. The test probably only needs to make sure that it ends the stream it started, rather than trying to ensure that there are no more streams. I'll plan to check it out more later, though nobody else should be dissuaded from tackling it in case I don't. :) Just wanted to submit the other patches now.

Thank you!

comment:3 Changed 4 years ago by saturn597

Sorry! Overlooked a couple of issues in my code, and didn't include the ticket number in the commit message, but somehow didn't see until after I'd submitted. One more commit, here:

https://github.com/saturn597/stem/commit/acb5aee2620ee8668c308e1fb7b5a905863b2efe

Thanks again for taking a look!

comment:4 Changed 4 years ago by atagar

Resolution: fixed
Status: needs_reviewclosed

Hazza, passing tests! Thanks for the fix Jeremy. Squashed your commits and pushed with some very minor tweaks...

https://gitweb.torproject.org/stem.git/commitdiff/2257f7954a0d9dba46905a4813b828fcc0b52086

STATIC CHECKS
* /home/atagar/Desktop/stem/test/integ/control/controller.py
  line 817  - W293 blank line contains whitespace
  line 821  - W293 blank line contains whitespace

If you have pep8 installed and run either 'run_tests.py --style' or 'run_tests.py --all' stem will check for any style issues.

for _ in range(10):

When using range in a loop xrange() is preferable. The range() function provides a list and xrange() an iterator. In this case it doesn't make a difference, but when dealing with large ranges (say, range(90000)) it can improve performance a bit.

Note: See TracTickets for help on using tickets.