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

Function AwaitNotState

internal/testutils/state.go:69–76  ·  view source on GitHub ↗

AwaitNotState waits for sc to leave stateDoNotWant or fatal errors if it doesn't happen before ctx expires.

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

Source from the content-addressed store, hash-verified

67// AwaitNotState waits for sc to leave stateDoNotWant or fatal errors if it
68// doesn't happen before ctx expires.
69func AwaitNotState(ctx context.Context, t *testing.T, sc StateChanger, stateDoNotWant connectivity.State) {
70 t.Helper()
71 for state := sc.GetState(); state == stateDoNotWant; state = sc.GetState() {
72 if !sc.WaitForStateChange(ctx, state) {
73 t.Fatalf("Timed out waiting for state change. got %v; want NOT %v", state, stateDoNotWant)
74 }
75 }
76}
77
78// AwaitNoStateChange expects ctx to be canceled before sc's state leaves
79// currState, and fatal errors otherwise.

Calls 3

GetStateMethod · 0.65
WaitForStateChangeMethod · 0.65
FatalfMethod · 0.65