diff --git a/test/xds/xds_server_test.go b/test/xds/xds_server_test.go index 7d87484f4479..911e28df47bf 100644 --- a/test/xds/xds_server_test.go +++ b/test/xds/xds_server_test.go @@ -138,7 +138,7 @@ func (s) TestServeLDSRDS(t *testing.T) { // waitForFailedRPCWithStatusCode makes Unary RPC's until it receives the // expected status in a polling manner. Fails if the RPC made does not return // the expected status before the context expires. -func waitForFailedRPCWithStatusCode(ctx context.Context, t *testing.T, cc *grpc.ClientConn, st ...*status.Status) { +func waitForFailedRPCWithStatusCode(ctx context.Context, t *testing.T, cc *grpc.ClientConn, sts ...*status.Status) { t.Helper() c := testgrpc.NewTestServiceClient(cc) @@ -150,9 +150,12 @@ func waitForFailedRPCWithStatusCode(ctx context.Context, t *testing.T, cc *grpc. case <-ctx.Done(): t.Fatalf("failure when waiting for RPCs to fail with certain status %v: %v. most recent error received from RPC: %v", st, ctx.Err(), err.Error()) case <-ticker.C: - if _, err = c.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) == st.Code() && strings.Contains(err.Error(), st.Message()) { - t.Logf("most recent error happy case: %v", err.Error()) - return + _, err = c.EmptyCall(ctx, &testpb.Empty{}) + for _, st := range sts { + if status.Code(err) == st.Code() && strings.Contains(err.Error(), st.Message()) { + t.Logf("most recent error happy case: %v", err.Error()) + return + } } } }