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) }