MCPcopy
hub / github.com/grpc/grpc-go / AwaitState

Function AwaitState

internal/testutils/state.go:58–65  ·  view source on GitHub ↗

AwaitState waits for sc to enter stateWant or fatal errors if it doesn't happen before ctx expires.

(ctx context.Context, t *testing.T, sc StateChanger, stateWant connectivity.State)

Source from the content-addressed store, hash-verified

56// AwaitState waits for sc to enter stateWant or fatal errors if it doesn't
57// happen before ctx expires.
58func AwaitState(ctx context.Context, t *testing.T, sc StateChanger, stateWant connectivity.State) {
59 t.Helper()
60 for state := sc.GetState(); state != stateWant; state = sc.GetState() {
61 if !sc.WaitForStateChange(ctx, state) {
62 t.Fatalf("Timed out waiting for state change. got %v; want %v", state, stateWant)
63 }
64 }
65}
66
67// AwaitNotState waits for sc to leave stateDoNotWant or fatal errors if it
68// doesn't happen before ctx expires.

Calls 3

GetStateMethod · 0.65
WaitForStateChangeMethod · 0.65
FatalfMethod · 0.65