diff --git a/test/cpp/end2end/xds_end2end_test.cc b/test/cpp/end2end/xds_end2end_test.cc index 2fad87d9d90..895d7defde6 100644 --- a/test/cpp/end2end/xds_end2end_test.cc +++ b/test/cpp/end2end/xds_end2end_test.cc @@ -5444,17 +5444,17 @@ class XdsSecurityTest : public BasicTest { } balancers_[0]->ads_service()->SetCdsResource(cluster); // The updates might take time to have an effect, so use a retry loop. - constexpr int kRetryCount = 10; + constexpr int kRetryCount = 100; int num_tries = 0; for (; num_tries < kRetryCount; num_tries++) { // Give some time for the updates to propagate. gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(100)); - ShutdownBackend(0); - StartBackend(0); - ResetBackendCounters(); if (test_expects_failure) { - Status status = SendRpc(); - if (status.ok()) { + // Restart the servers to force a reconnection so that previously + // connected subchannels are not used for the RPC. + ShutdownBackend(0); + StartBackend(0); + if (SendRpc().ok()) { gpr_log(GPR_ERROR, "RPC succeeded. Failure expected. Trying again."); continue; }