diff options
author | Sree Kuchibhotla <sreecha@users.noreply.github.com> | 2017-12-11 11:17:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 11:17:04 -0800 |
commit | 7fd341746b3fc144a18e8b8491be5264d01eb7f8 (patch) | |
tree | 7fffac785820213a92ba132b2f1be5d2bb5a259b /test | |
parent | 866db6e9b1d8b1424b1e6640db4ffd955aaea276 (diff) | |
parent | cc6601e213f3818f8bf1bbb6ddeac27a8d3a20ed (diff) |
Merge pull request #13678 from sreecha/rpc-deadline-fix
Tweak the RpcDeadline test to reduce flakes
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 1d63f395dc..4c8dfe0f40 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1308,12 +1308,19 @@ TEST_P(ProxyEnd2endTest, RpcDeadlineExpires) { EchoResponse response; request.set_message("Hello"); request.mutable_param()->set_skip_cancelled_check(true); - // Let server sleep for 2 ms first to guarantee expiry - request.mutable_param()->set_server_sleep_us(2 * 1000); + // Let server sleep for 40 ms first to guarantee expiry. + // 40 ms might seem a bit extreme but the timer manager would have been just + // initialized (when ResetStub() was called) and there are some warmup costs + // i.e the timer thread many not have even started. There might also be other + // delays in the timer manager thread (in acquiring locks, timer data + // structure manipulations, starting backup timer threads) that add to the + // delays. 40ms is still not enough in some cases but this significantly + // reduces the test flakes + request.mutable_param()->set_server_sleep_us(40 * 1000); ClientContext context; std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::microseconds(10); + std::chrono::system_clock::now() + std::chrono::milliseconds(1); context.set_deadline(deadline); Status s = stub_->Echo(&context, request, &response); EXPECT_EQ(StatusCode::DEADLINE_EXCEEDED, s.error_code()); |