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

Function TestWaitBuffer_WaitFor_BackgroundGoroutine

testutil/wait_buffer_test.go:135–152  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

133}
134
135func TestWaitBuffer_WaitFor_BackgroundGoroutine(t *testing.T) {
136 t.Parallel()
137
138 ctx, cancel := context.WithCancel(context.Background())
139 cancel() // Expire immediately.
140
141 wb := testutil.NewWaitBuffer()
142
143 // WaitFor from a background goroutine should return the
144 // context error rather than calling t.Fatal.
145 done := make(chan error, 1)
146 go func() {
147 done <- wb.WaitFor(ctx, "never")
148 }()
149
150 err := <-done
151 require.ErrorIs(t, err, context.Canceled)
152}
153
154func TestWaitBuffer_SequentialWaits(t *testing.T) {
155 t.Parallel()

Callers

nothing calls this directly

Calls 2

WaitForMethod · 0.95
NewWaitBufferFunction · 0.92

Tested by

no test coverage detected