Skip to content

Commit 81df680

Browse files
authored
tests: avoid flakes in xds_failover_integration_test-GoogleGrpc case by waiting for a stream before disconnecting (#40327)
Signed-off-by: Adi Suissa-Peleg <[email protected]>
1 parent f200689 commit 81df680

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/extensions/config_subscription/grpc/xds_failover_integration_test.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,15 @@ class XdsFailoverAdsIntegrationTest : public AdsDeltaSotwIntegrationSubStatePara
179179
void primaryConnectionFailure() {
180180
AssertionResult result = xds_upstream_->waitForHttpConnection(*dispatcher_, xds_connection_);
181181
RELEASE_ASSERT(result, result.message());
182+
// When GoogleGrpc is used, there may be cases where the connection will be
183+
// disconnected before the gRPC library observes the TLS handshake, which will
184+
// end up in a fast retry without notifying Envoy that the connection was
185+
// disconnected. We wait for a stream to ensure that the gRPC library
186+
// observed a successful connection.
187+
if (clientType() == Grpc::ClientType::GoogleGrpc) {
188+
result = xds_connection_->waitForNewStream(*dispatcher_, xds_stream_);
189+
RELEASE_ASSERT(result, result.message());
190+
}
182191
result = xds_connection_->close();
183192
RELEASE_ASSERT(result, result.message());
184193
}

0 commit comments

Comments
 (0)