mirror of
https://github.com/openziti/ziti.git
synced 2026-09-10 00:35:41 +00:00
Wait for the hosting side before tearing down the listener-close test
Test_ServerCloseListenerPropagation never received from errC, so it was the only test in the file that did not wait for its hosting goroutine. Reading the last reply only proves the data reached the wire: the SDK writes with SendAndWaitForWire, so the write is still waiting to be told its buffer went out. The test body returning ran the deferred conn, listener, context and context-teardown closes under it, which resolved that wait as "channel closed" and failed a write whose data the client already had. - waits on errC before returning, matching the other six tests in the file The window is between the data hitting the wire and the sender being notified, so it does not reproduce on an idle machine; it showed up on a loaded CI runner as a single failure with no client-side error, which is what identified the ordering.
This commit is contained in:
@@ -219,6 +219,18 @@ func Test_ServerCloseListenerPropagation(t *testing.T) {
|
||||
name = eid.New()
|
||||
conn.WriteString(name, time.Second)
|
||||
conn.ReadExpected("hello, "+name, time.Second)
|
||||
|
||||
// Wait for the hosting side to finish before the deferred teardown runs. Reading the last
|
||||
// reply only proves the data reached the wire, not that the hosting write has returned:
|
||||
// the SDK writes with SendAndWaitForWire, so the write is still waiting to be told its
|
||||
// buffer went out. Closing the context under it resolves that wait as "channel closed"
|
||||
// and fails a write whose data the client already has.
|
||||
select {
|
||||
case err := <-errC:
|
||||
ctx.Req.NoError(err)
|
||||
case <-time.After(2 * time.Second):
|
||||
t.Fatal("timed out after 2 seconds")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ClientConnClosePropagation(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user