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

Function AssertSend

testutil/chan.go:109–118  ·  view source on GitHub ↗

AssertSend will send the given value over the chan and then return. If the context expires before the send succeeds, it will mark the test as failed but continue execution. The second return value indicates whether the send was successful. Safety: can be called from any goroutine.

(ctx context.Context, t testing.TB, c chan<- A, a A)

Source from the content-addressed store, hash-verified

107//
108// Safety: can be called from any goroutine.
109func AssertSend[A any](ctx context.Context, t testing.TB, c chan<- A, a A) bool {
110 t.Helper()
111 select {
112 case <-ctx.Done():
113 assert.Fail(t, "AssertSend: context expired")
114 return false
115 case c <- a:
116 return true
117 }
118}

Callers 3

mockTelemetryServerFunction · 0.92
TestIntegrationFunction · 0.92

Calls 3

HelperMethod · 0.65
DoneMethod · 0.45
FailMethod · 0.45

Tested by 3

mockTelemetryServerFunction · 0.74
TestIntegrationFunction · 0.74