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)
| 67 | // AwaitNotState waits for sc to leave stateDoNotWant or fatal errors if it |
| 68 | // doesn't happen before ctx expires. |
| 69 | func 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. |