From 196bd4eb06e881df955320e6b36cc8cb09c712fb Mon Sep 17 00:00:00 2001 From: mwilsnd <53413200+mwilsnd@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:40:05 -0400 Subject: [PATCH] Address some flaky tests (#2837) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- test/map/map.test.cpp | 5 ++++- test/util/run_loop.test.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index aaad37f29..b72faeeaa 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -1808,7 +1808,10 @@ TEST(Map, ObserveTileLifecycle) { case TileOperation::StartParse: { // Parsing is expected to be started early during the request process by a call to `setLayers` EXPECT_THAT(stage, - testing::AnyOf(TileOperation::RequestedFromCache, TileOperation::RequestedFromNetwork)); + testing::AnyOf(TileOperation::RequestedFromCache, + TileOperation::RequestedFromNetwork, + TileOperation::LoadFromCache, + TileOperation::LoadFromNetwork)); EXPECT_FALSE(parsing); // We must not already be parsing when seeing this marker. stage = TileOperation::StartParse; parsing = true; diff --git a/test/util/run_loop.test.cpp b/test/util/run_loop.test.cpp index ef532e3fd..54eae8f56 100644 --- a/test/util/run_loop.test.cpp +++ b/test/util/run_loop.test.cpp @@ -82,6 +82,7 @@ TEST(RunLoop, PlatformIntegration) { loop.setPlatformCallback([&] { EXPECT_NE(mainThread, std::this_thread::get_id()); count1++; + std::unique_lock lock(mutex); cv.notify_one(); }); @@ -100,6 +101,7 @@ TEST(RunLoop, PlatformIntegration) { while (count2 < 200000) { std::unique_lock lock(mutex); cv.wait(lock); + lock.unlock(); loop.runOnce(); }