Closed jhendrixMSFT closed 1 year ago
See also
--- FAIL: TestNewSenderTimedOut (0.12s)
sender_test.go:1108:
Error Trace: sender_test.go:1108
Error: Target error should be in err chain:
expected: "context deadline exceeded"
in chain:
Test: TestNewSenderTimedOut
This can cause spurious test failures like this one.
Internally, Write() calls the registered response handler, and if the handler sleeps e.g. to simulate a slow response, that delay is reflected in the call to
c.writeFrame()
fromConn.connWriter
instead of asynchronously.What needs to happen is, in
fake.NetConn.Write()
, the incoming bytes should be queued up for processing (i.e. dispatching ton.resp()
) on a separate goroutine so that any delays aren't reflected in the call toc.writeFrame()
.Will also need to consider the case where a test simulates a write error. In that case, don't dispatch to the processing goroutine.