MCPcopy Index your code
hub / github.com/coder/coder / withDone

Function withDone

agent/reaper/reaper_test.go:63–75  ·  view source on GitHub ↗

withDone returns options that stop the reaper goroutine when t completes and wait for it to fully exit, preventing overlapping reapers across sequential subtests.

(t *testing.T)

Source from the content-addressed store, hash-verified

61// completes and wait for it to fully exit, preventing
62// overlapping reapers across sequential subtests.
63func withDone(t *testing.T) []reaper.Option {
64 t.Helper()
65 stop := make(chan struct{})
66 stopped := make(chan struct{})
67 t.Cleanup(func() {
68 close(stop)
69 <-stopped
70 })
71 return []reaper.Option{
72 reaper.WithReaperStop(stop),
73 reaper.WithReaperStopped(stopped),
74 }
75}
76
77// TestReap checks that the reaper successfully reaps exited
78// processes and passes their PIDs through the shared channel.

Callers 3

TestReapFunction · 0.85
TestForkReapExitCodesFunction · 0.85
TestReapInterruptFunction · 0.85

Calls 4

WithReaperStopFunction · 0.92
WithReaperStoppedFunction · 0.92
HelperMethod · 0.65
CleanupMethod · 0.65

Tested by

no test coverage detected