Opened 2 years ago

Closed 2 years ago

#5899 defect closed fixed (fixed)

twisted.internet.test.test_tcp.TCPTransportServerAddressTestMixin._testServerAddress hangs for the test method timeout when it fails

Reported by: exarkun Owned by: exarkun
Priority: high Milestone:
Component: core Keywords: tests
Cc: Branch: branches/faster-serveraddresstcp4-failure-5899
(diff, github, buildbot, log)
Author: exarkun Launchpad Bug:

Description

This test method helper relies on getConnectedClientAndServer to stop the reactor after the client/server connection is lost.

The connection is closed at the end of the nested connected callback inside _testServerAddress. However, if any of the assertions in connected fail, the connection won't be closed and the test will hang until the timeout triggers.

Change History (6)

comment:1 Changed 2 years ago by exarkun

  • Owner set to exarkun
  • Status changed from new to assigned

comment:2 Changed 2 years ago by exarkun

  • Author set to exarkun
  • Branch set to branches/faster-serveraddresstcp4-failure-5899

(In [35494]) Branching to 'faster-serveraddresstcp4-failure-5899'

comment:3 Changed 2 years ago by exarkun

(In [35495]) Close the connection with a try/finally

refs #5899

comment:4 Changed 2 years ago by exarkun

  • Keywords review added
  • Owner exarkun deleted
  • Status changed from assigned to new

When this test fails like this:

2012-09-03 09:06:45-0400 [Uninitialized] Unhandled Error
        Traceback (most recent call last):
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 551, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/test/test_tcp.py", line 1414, in start
            deferred.callback((client, server, port))
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 368, in callback
            self._startRunCallbacks(result)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 464, in _startRunCallbacks
            self._runCallbacks()
        --- <exception caught here> ---
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/defer.py", line 551, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/internet/test/test_tcp.py", line 1335, in connected
            server.transport.logstr)
          File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/unittest.py", line 271, in assertEqual
            % (msg, pformat(first), pformat(second)))
        twisted.trial.unittest.FailTest: not equal:
        a = 'AccumulatingProtocol,0,127.0.0.1'
        b = 'AccumulatingProtocol,0,10.0.0.1'

it now does so immediately rather than only after two minutes. Build results

comment:5 Changed 2 years ago by therve

  • Keywords review removed
  • Owner set to exarkun

Looks goods, sorry for writing the bad test in the first place... Please merge.

comment:6 Changed 2 years ago by exarkun

  • Resolution set to fixed
  • Status changed from new to closed

(In [35704]) Merge faster-serveraddresstcp4-failure-5899

Author: exarkun
Reviewer: therve
Fixes: #5899

Speed up the failure of some twisted.internet.test.test_tcp tests, should they fail at all.

Note: See TracTickets for help on using tickets.