From 27dab0b9534e4dc4a9b6a466a9fa4ff1f9a26d3d Mon Sep 17 00:00:00 2001 From: Ian Wagner Date: Mon, 4 Nov 2024 16:07:09 +0900 Subject: [PATCH] Fix a data race in unit test --- .github/workflows/android.yml | 1 - apple/Tests/FerrostarCoreTests/FerrostarCoreTests.swift | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 1c9e9e1a..63651ef8 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -52,7 +52,6 @@ jobs: working-directory: android test: - runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.ref }}-android-test diff --git a/apple/Tests/FerrostarCoreTests/FerrostarCoreTests.swift b/apple/Tests/FerrostarCoreTests/FerrostarCoreTests.swift index 1a860c48..c5fc4423 100644 --- a/apple/Tests/FerrostarCoreTests/FerrostarCoreTests.swift +++ b/apple/Tests/FerrostarCoreTests/FerrostarCoreTests.swift @@ -395,6 +395,11 @@ final class FerrostarCoreTests: XCTestCase { await fulfillment(of: [routeDeviationCallbackExp], timeout: 1.0) await fulfillment(of: [loadedAltRoutesExp], timeout: 1.0) + // At this point, there is a brief window where the delegate call loading alternate routes has completed, + // but the state is still updating. This is a quick hack to fix the tests + // in the absence of something more reliable. + try? await Task.sleep(nanoseconds: NSEC_PER_SEC / 10) + XCTAssert(core.state?.isCalculatingNewRoute == false, "Expected to no longer be calculating a new route") }