From ecf5821269110b506e7f3400b9ba18a2bf9b72e2 Mon Sep 17 00:00:00 2001 From: Fredrik Oseberg Date: Fri, 1 Dec 2023 12:04:47 +0100 Subject: [PATCH] fix: update readme --- .github/workflows/build.yml | 8 +------- README.md | 10 ++++++++++ .../UnleashClientIntegrationTest.swift | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b12e99f..34f5d5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,10 +16,4 @@ jobs: steps: - uses: actions/checkout@v2 - name: Run tests - run: swift test --sanitize=thread - test-sanitize: - runs-on: macos-latest - steps: - - uses: actions/checkout@v2 - - name: Run tests - run: 'swift test --sanitize=thread 2>&1 | grep "ThreadSanitizer: data race" || exit 0; exit 1' + run: swift test --sanitize=thread \ No newline at end of file diff --git a/README.md b/README.md index d3b3cf3..3d5a2c9 100644 --- a/README.md +++ b/README.md @@ -184,3 +184,13 @@ Once that succeeds, you can do the actual release: ```sh pod trunk push UnleashProxyClientSwift.podspec --allow-warnings ``` + +## Testing + +In order to test this package you can run the swift test command. To test thread safety, run swift test with: + +``` +swift test --sanitize=thread +``` + +This will give you warnings in the console when you have any data races. diff --git a/Tests/UnleashProxyClientSwiftTests/UnleashClientIntegrationTest.swift b/Tests/UnleashProxyClientSwiftTests/UnleashClientIntegrationTest.swift index fce4c45..cb49c72 100644 --- a/Tests/UnleashProxyClientSwiftTests/UnleashClientIntegrationTest.swift +++ b/Tests/UnleashProxyClientSwiftTests/UnleashClientIntegrationTest.swift @@ -48,7 +48,7 @@ class UnleashIntegrationTests: XCTestCase { // Run isEnabled many times to trigger a data race when the poller is updating the data cache // This is to test that the poller is thread safe, and you can verify this by running the test with // swift test --sanitize=thread - for _ in 1...25000 { + for _ in 1...15000 { let result = unleashClient.isEnabled(name: "dataRaceTest") XCTAssertFalse(result) }