Opened 5 years ago

Closed 4 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: Jean-Paul Calderone Owned by: Jean-Paul Calderone
Priority: high Milestone:
Component: core Keywords: tests
Cc: Branch: branches/faster-serveraddresstcp4-failure-5899
branch-diff, diff-cov, branch-cov, buildbot
Author: exarkun

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 4 years ago by Jean-Paul Calderone

Owner: set to Jean-Paul Calderone
Status: newassigned

comment:2 Changed 4 years ago by Jean-Paul Calderone

Author: exarkun
Branch: branches/faster-serveraddresstcp4-failure-5899

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

comment:3 Changed 4 years ago by Jean-Paul Calderone

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

refs #5899

comment:4 Changed 4 years ago by Jean-Paul Calderone

Keywords: review added
Owner: Jean-Paul Calderone deleted
Status: assignednew

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 4 years ago by therve

Keywords: review removed
Owner: set to Jean-Paul Calderone

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

comment:6 Changed 4 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(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.