Address some flaky tests (#2837)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2024-09-16 13:40:05 -04:00
committed by GitHub
parent 9b2798b982
commit 196bd4eb06
2 changed files with 6 additions and 1 deletions

View File

@@ -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;

View File

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