#2085 new defect

Unit tests should work offline

Reported by: markberger Owned by:
Priority: normal Milestone: undecided
Component: code-network Version: 1.10.0
Keywords: foolscap test Cc: leif@…
Launchpad Bug:

Description

I noticed that a handful of unit tests fail when the user isn't connected to the internet. Ideally these unit tests would just skip if there is no internet connection.

[FAIL]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 137, in maybeDeferred
    result = f(*args, **kw)
  File "/home/markberger/code/tahoe-lafs/src/allmydata/util/pollmixin.py", line 49, in _poll
    self.fail("Errors snooped, terminating early")
twisted.trial.unittest.FailTest: Errors snooped, terminating early

allmydata.test.test_keygen.KeyGenService.test_key_gen_service
allmydata.test.test_system.SystemTest.test_filesystem
allmydata.test.test_system.SystemTest.test_mutable
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/home/markberger/code/tahoe-lafs/support/lib/python2.7/site-packages/foolscap-0.6.4-py2.7.egg/foolscap/pb.py", line 535, in _reactor_running
    return util.get_local_ip_for()
  File "/home/markberger/code/tahoe-lafs/support/lib/python2.7/site-packages/foolscap-0.6.4-py2.7.egg/foolscap/util.py", line 70, in get_local_ip_for
    target_ipaddr = socket.gethostbyname(target)
socket.error: [Errno 110] Connection timed out

allmydata.test.test_keygen.KeyGenService.test_key_gen_service
allmydata.test.test_keygen.KeyGenService.test_key_gen_service
allmydata.test.test_system.SystemTest.test_filesystem
allmydata.test.test_system.SystemTest.test_mutable
===============================================================================
[ERROR]
Traceback (most recent call last):
Failure: twisted.internet.defer.TimeoutError: <allmydata.test.test_runner.RunNode testMethod=test_keygen> (test_keygen) still running at 240.0 secs

allmydata.test.test_runner.RunNode.test_keygen
===============================================================================
[ERROR]
Traceback (most recent call last):
Failure: twisted.trial.util.DirtyReactorAggregateError: Reactor was unclean.
DelayedCalls: (set twisted.internet.base.DelayedCall.debug = True to debug)
<DelayedCall 0x37863f8 [0.00365591049194s] called=0 cancelled=0 LoopingCall<0.01>(RunNode._poll, *(<function _node_has_started at 0x4bd16e0>, 1379704909.620077), **{})()>

allmydata.test.test_runner.RunNode.test_keygen

Change History (4)

comment:1 in reply to: ↑ description ; follow-up: Changed at 2013-09-20T20:45:18Z by leif

  • Cc leif@… added

Replying to markberger:

Ideally these unit tests would just skip if there is no internet connection.

I think the test suite shouldn't ever try to connect to the internet.

comment:2 Changed at 2013-09-20T20:47:13Z by zooko

I agree with Leif. By the way, I don't know, off the top of my head, why these tests behave differently when the user isn't connected to the Internet.

comment:3 in reply to: ↑ 1 Changed at 2013-09-21T03:55:33Z by daira

Replying to leif:

I think the test suite shouldn't ever try to connect to the internet.

+1, although I think the issue here is finding addresses for furl connection hints, rather than actually connecting to anywhere outside the local machine.

comment:4 Changed at 2013-09-21T03:59:20Z by daira

  • Component changed from dev-infrastructure to code-network
  • Keywords foolscap test added
Note: See TracTickets for help on using tickets.