Skip to content

Commit ecc5645

Browse files
authored
clusterresolver: fix a flaky test (#6499)
1 parent b9356e3 commit ecc5645

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

xds/internal/balancer/clusterresolver/e2e_test/balancer_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,11 @@ func (s) TestErrorFromParentLB_ResourceNotFound(t *testing.T) {
276276
t.Fatalf("RPCs did not fail after removal of Cluster resource")
277277
}
278278

279-
// Ensure that the ClientConn is in TransientFailure.
280-
if state := cc.GetState(); state != connectivity.TransientFailure {
281-
t.Fatalf("Unexpected connectivity state for ClientConn, got: %s, want %s", state, connectivity.TransientFailure)
279+
// Ensure that the ClientConn moves to TransientFailure.
280+
for state := cc.GetState(); state != connectivity.TransientFailure; state = cc.GetState() {
281+
if !cc.WaitForStateChange(ctx, state) {
282+
t.Fatalf("Timed out waiting for state change. got %v; want %v", state, connectivity.TransientFailure)
283+
}
282284
}
283285

284286
// Configure cluster and endpoints resources in the management server.

0 commit comments

Comments
 (0)