Opened 7 years ago

Closed 7 years ago

#8692 closed defect (fixed)

ONLINE integ target fails

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


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

ERROR: test_attachstream
  File "/home/atagar/Desktop/stem/test/integ/control/", line 974, in test_attachstream
    circuit_id = controller.new_circuit(await_build = True)
  File "/home/atagar/Desktop/stem/stem/", line 1781, in new_circuit
    return self.extend_circuit('0', path, purpose, await_build)
  File "/home/atagar/Desktop/stem/stem/", 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
  File "/home/atagar/Desktop/stem/test/integ/control/", line 791, in test_mapaddress
    test.util.negotiate_socks(s, '', 80)
  File "/home/atagar/Desktop/stem/test/", 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
  File "/home/atagar/Desktop/stem/test/integ/control/", line 769, in test_close_stream
    self.assertEqual([], [ for stream in controller.get_streams()])
AssertionError: Lists differ: ['34'] != ['34', '13', '530']

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

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

Ran 31 tests in 28.013s


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 7 years ago by atagar

Keywords: testing easy added

comment:2 Changed 7 years ago by saturn597

Cc: saturn5971@… added
Status: newneeds_review

Here's a patch that might help:

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 7 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:

Thanks again for taking a look!

comment:4 Changed 7 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...

* /home/atagar/Desktop/stem/test/integ/control/
  line 817  - W293 blank line contains whitespace
  line 821  - W293 blank line contains whitespace

If you have pep8 installed and run either ' --style' or ' --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.