Skip to content

Commit d7057e8

Browse files
committed
dap: ensure test client is closed on cleanup
The dap test wasn't waiting for the client's goroutines to complete before exiting which caused a race condition that could cause it to log to the dead test logger. This became apparent when `--count` of greater than one was used since it caused the test to run long enough to trigger the behavior. It would have also triggered if we had added more tests. Add the client close to the cleanup so it waits for the goroutine to finish before the test exits as it was properly supposed to do.
1 parent 0567803 commit d7057e8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

dap/adapter_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
)
1515

1616
func TestLaunch(t *testing.T) {
17-
t.Skip("test fails with errgroup v0.16.0, that doesn't swallow panic in goroutine")
18-
1917
adapter, conn, client := NewTestAdapter[common.Config](t)
2018

2119
ctx, cancel := context.WithTimeoutCause(context.Background(), 10*time.Second, context.DeadlineExceeded)
@@ -83,14 +81,14 @@ func NewTestAdapter[C LaunchConfig](t *testing.T) (*Adapter[C], Conn, *Client) {
8381
})
8482

8583
clientConn := logConn(t, "client", NewConn(rd2, wr1))
86-
t.Cleanup(func() {
87-
clientConn.Close()
88-
})
84+
t.Cleanup(func() { clientConn.Close() })
8985

9086
adapter := New[C]()
9187
t.Cleanup(func() { adapter.Stop() })
9288

9389
client := NewClient(clientConn)
90+
t.Cleanup(func() { client.Close() })
91+
9492
return adapter, srvConn, client
9593
}
9694

0 commit comments

Comments
 (0)