Commit db617fa
committed
test(transport/file): goleak-track Conn.Close
`transport/file/main_test.go` runs `goleak.VerifyTestMain`, so a
leaked server goroutine eventually fails the package — but at
teardown, with no signal pointing to the test that produced the
leak. Mirror `transport/ssh`'s `TestConn_Close_Idempotent` shape:
open a real Conn, call `Close` twice, and wrap the body in
`goleak.VerifyNone(t)` so the failure mode is per-test.
The Conn is constructed against a real on-disk fixture so the
goroutine reaches its real shutdown path
(`cancel → pipe close → <-c.done`); a struct-literal Conn would
short-circuit before that path runs.
The test is not marked `t.Parallel()`: `goleak.VerifyNone`
snapshots the live goroutine set, so concurrent `testing.tRunner`
frames from sibling parallel tests register as unexpected stacks
and fail the verification. The package-wide `VerifyTestMain`
already covers cross-test leak surfaces; this test pins the
per-test shutdown contract.
Signed-off-by: Hidde Beydals <hidde@hhh.computer>1 parent 9d61dcc commit db617fa
1 file changed
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments