aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2018-12-06 12:27:41 -0800
committerGravatar Mark D. Roth <roth@google.com>2018-12-06 12:27:41 -0800
commit3dd24ea9789fcc455842b9582102f8c261e0bb1c (patch)
treef39a88fc5398892aff7c23eeeb6149aca1c372f4 /test
parent5f806d77dc9ddf0b3bec066bf71ff6dc76a6e504 (diff)
code review changes
Diffstat (limited to 'test')
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index 1a7b36cdc0..f60f110c5f 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -527,24 +527,27 @@ TEST_F(ClientLbEnd2endTest,
// Trigger a second connection attempt. This should also fail
// ~immediately, but the retry should be scheduled for
// kInitialBackOffMs instead of applying the multiplier.
- gpr_log(GPR_INFO, "=== TRIGGERING SECOND CONNECTION ATTEMPT");
+ gpr_log(GPR_INFO, "=== POLLING FOR SECOND CONNECTION ATTEMPT");
+ const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
EXPECT_FALSE(
channel->WaitForConnected(grpc_timeout_milliseconds_to_deadline(10)));
// Bring up a server on the chosen port.
gpr_log(GPR_INFO, "=== STARTING BACKEND");
StartServers(1, ports);
// Wait for connect. Should happen within kInitialBackOffMs.
- gpr_log(GPR_INFO, "=== TRIGGERING THIRD CONNECTION ATTEMPT");
- const gpr_timespec t0 = gpr_now(GPR_CLOCK_MONOTONIC);
+ // Give an extra 100ms to account for the time spent in the second and
+ // third connection attempts themselves (since what we really want to
+ // measure is the time between the two). As long as this is less than
+ // the 1.6x increase we would see if the backoff state was not reset
+ // properly, the test is still proving that the backoff was reset.
+ constexpr int kWaitMs = kInitialBackOffMs + 100;
+ gpr_log(GPR_INFO, "=== POLLING FOR THIRD CONNECTION ATTEMPT");
EXPECT_TRUE(channel->WaitForConnected(
- grpc_timeout_milliseconds_to_deadline(kInitialBackOffMs)));
+ grpc_timeout_milliseconds_to_deadline(kWaitMs)));
const gpr_timespec t1 = gpr_now(GPR_CLOCK_MONOTONIC);
const grpc_millis waited_ms = gpr_time_to_millis(gpr_time_sub(t1, t0));
gpr_log(GPR_DEBUG, "Waited %" PRId64 " milliseconds", waited_ms);
- // Give an extra 100ms for timing slack.
- // (This is still far less than the 1.6x increase we would see if the
- // backoff state was not reset properly.)
- EXPECT_LT(waited_ms, kInitialBackOffMs + 100);
+ EXPECT_LT(waited_ms, kWaitMs);
}
TEST_F(ClientLbEnd2endTest, PickFirstUpdates) {