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

Function TestWaitBuffer_RequireWaitFor_Timeout

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

Source from the content-addressed store, hash-verified

204}
205
206func TestWaitBuffer_RequireWaitFor_Timeout(t *testing.T) {
207 t.Parallel()
208
209 // Use a mock testing.TB to capture the fatal call without
210 // killing the real test.
211 mock := &tbMock{}
212 ctx, cancel := context.WithCancel(context.Background())
213 cancel()
214
215 wb := testutil.NewWaitBuffer()
216 _, err := wb.Write([]byte("some output"))
217 require.NoError(t, err)
218
219 wb.RequireWaitFor(ctx, mock, "missing-signal")
220 assert.True(t, mock.failed(), "expected RequireWaitFor to fail the mock test")
221}
222
223// tbMock is a minimal testing.TB that records Fatalf calls.
224type tbMock struct {

Callers

nothing calls this directly

Calls 4

WriteMethod · 0.95
RequireWaitForMethod · 0.95
failedMethod · 0.95
NewWaitBufferFunction · 0.92

Tested by

no test coverage detected