aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2018-01-18 09:51:51 +0100
committerGravatar GitHub <noreply@github.com>2018-01-18 09:51:51 +0100
commit143fb810cc4c449f1faba2ba9710524627cd1793 (patch)
tree937476bd01a1f4e29a3415969460b73f29ddc025 /test/core
parent7dddc2365538168331e848723106657d56e22458 (diff)
parenta6ff754b93658e03e4a89b42855b8c74496b672e (diff)
Merge pull request #14005 from jtattermusch/fix_win_alarm_test
Fix alarm test flake on windows
Diffstat (limited to 'test/core')
-rw-r--r--test/core/surface/alarm_test.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/core/surface/alarm_test.cc b/test/core/surface/alarm_test.cc
index 8950603b41..67fc6833a5 100644
--- a/test/core/surface/alarm_test.cc
+++ b/test/core/surface/alarm_test.cc
@@ -34,8 +34,15 @@ static void* create_test_tag(void) {
static void shutdown_and_destroy(grpc_completion_queue* cc) {
grpc_event ev;
grpc_completion_queue_shutdown(cc);
- ev =
- grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
+ /* By the time grpc_completion_queue_shutdown runs, the cq's internal
+ pending event counter might not have been updated yet by a previous
+ cq_end_op_for_next (which releases a completed event first and only later
+ updates the pending event counter), so we can't rely on a no-polling
+ cq_next to never return GRPC_QUEUE_TIMEOUT. Using a deadline in the future
+ solves the problem. See https://github.com/grpc/grpc/issues/13693.
+ */
+ ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(2),
+ nullptr);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cc);
}