Skip to content

Commit

Permalink
Address some flaky tests (#2837)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
mwilsnd and pre-commit-ci[bot] authored Sep 16, 2024
1 parent 9b2798b commit 196bd4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/map/map.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions test/util/run_loop.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ TEST(RunLoop, PlatformIntegration) {
loop.setPlatformCallback([&] {
EXPECT_NE(mainThread, std::this_thread::get_id());
count1++;
std::unique_lock<std::mutex> lock(mutex);
cv.notify_one();
});

Expand All @@ -100,6 +101,7 @@ TEST(RunLoop, PlatformIntegration) {
while (count2 < 200000) {
std::unique_lock<std::mutex> lock(mutex);
cv.wait(lock);
lock.unlock();
loop.runOnce();
}

Expand Down

0 comments on commit 196bd4e

Please sign in to comment.