From 7f37d1cb0e5a6f865da2742ce783b4fa116e47a7 Mon Sep 17 00:00:00 2001 From: Prashant Jaikumar Date: Mon, 25 Feb 2019 12:10:47 -0800 Subject: [PATCH] Fix test flakes in flaky_network_test - Set channel arg for maximum time between reconnection attempts. - Don't check status of RPCs that can fail due to network flakiness. --- test/cpp/end2end/flaky_network_test.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/cpp/end2end/flaky_network_test.cc b/test/cpp/end2end/flaky_network_test.cc index 20c8fb59fa2..d0c95740959 100644 --- a/test/cpp/end2end/flaky_network_test.cc +++ b/test/cpp/end2end/flaky_network_test.cc @@ -339,11 +339,14 @@ TEST_F(FlakyNetworkTest, NetworkTransition) { TEST_F(FlakyNetworkTest, ServerUnreachableWithKeepalive) { const int kKeepAliveTimeMs = 1000; const int kKeepAliveTimeoutMs = 1000; + const int kReconnectBackoffMs = 1000; ChannelArguments args; args.SetInt(GRPC_ARG_KEEPALIVE_TIME_MS, kKeepAliveTimeMs); args.SetInt(GRPC_ARG_KEEPALIVE_TIMEOUT_MS, kKeepAliveTimeoutMs); args.SetInt(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS, 1); args.SetInt(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA, 0); + args.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, kReconnectBackoffMs); + args.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, kReconnectBackoffMs); auto channel = BuildChannel("pick_first", args); auto stub = BuildStub(channel); @@ -421,7 +424,7 @@ TEST_F(FlakyNetworkTest, FlakyNetwork) { // simulate flaky network (packet loss, corruption and delays) FlakeNetwork(); for (int i = 0; i < kMessageCount; ++i) { - EXPECT_TRUE(SendRpc(stub)); + SendRpc(stub); } // remove network flakiness UnflakeNetwork();