From 8cde81689dcfc74c9b59e088bbe00f95ca4bf68d Mon Sep 17 00:00:00 2001 From: Konstantin Varlamov Date: Thu, 10 May 2018 19:18:22 -0400 Subject: Firestore C++: quick fix for flaky tests in AsyncQueue and Executor (#1245) --- Firestore/core/test/firebase/firestore/util/executor_test.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Firestore/core/test/firebase/firestore/util/executor_test.cc') diff --git a/Firestore/core/test/firebase/firestore/util/executor_test.cc b/Firestore/core/test/firebase/firestore/util/executor_test.cc index e277786..99bddce 100644 --- a/Firestore/core/test/firebase/firestore/util/executor_test.cc +++ b/Firestore/core/test/firebase/firestore/util/executor_test.cc @@ -66,15 +66,19 @@ TEST_P(ExecutorTest, DestructorDoesNotBlockIfThereArePendingTasks) { ABORT_ON_TIMEOUT(future); } +// TODO(varconst): this test is inherently flaky because it can't be guaranteed +// that the enqueued asynchronous operation didn't finish before the code has +// a chance to even enqueue the next operation. Delays are chosen so that the +// test is unlikely to fail in practice. Need to revisit this. TEST_P(ExecutorTest, CanScheduleOperationsInTheFuture) { std::string steps; executor->Execute([&steps] { steps += '1'; }); - Schedule(executor.get(), Executor::Milliseconds(5), [&] { + Schedule(executor.get(), Executor::Milliseconds(20), [&] { steps += '4'; signal_finished(); }); - Schedule(executor.get(), Executor::Milliseconds(1), + Schedule(executor.get(), Executor::Milliseconds(10), [&steps] { steps += '3'; }); executor->Execute([&steps] { steps += '2'; }); -- cgit v1.2.3