feat: add resume support to coordinator connections (#14234)

This commit is contained in:
Dean Sheather
2024-08-20 17:16:49 +10:00
committed by GitHub
parent 0b2ba96065
commit cf8be4eac5
32 changed files with 1706 additions and 465 deletions

View File

@ -23,6 +23,9 @@ func RequireRecvCtx[A any](ctx context.Context, t testing.TB, c <-chan A) (a A)
}
}
// NOTE: no AssertRecvCtx because it'd be bad if we returned a default value on
// the cases it times out.
func RequireSendCtx[A any](ctx context.Context, t testing.TB, c chan<- A, a A) {
t.Helper()
select {
@ -32,3 +35,13 @@ func RequireSendCtx[A any](ctx context.Context, t testing.TB, c chan<- A, a A) {
// OK!
}
}
func AssertSendCtx[A any](ctx context.Context, t testing.TB, c chan<- A, a A) {
t.Helper()
select {
case <-ctx.Done():
t.Error("timeout")
case c <- a:
// OK!
}
}