Repository navigation
[FSSDK-13238] test: fix flaky LruCache, EventDispatcher, and concurrent logging tests - #662
Merged
Muzahidul Islam (muzahidul-opti) merged 2 commits intoOct 7, 2026
Conversation
With 100 threads writing into a size-3 cache, another thread can evict key i between save and lookup, so asserting the lookup returns v fails by chance. Assert that a hit holds the right value and that the cache ends within its size limit instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
- testDefaultDispatcher: mock the URL session instead of posting to the live event endpoint, which timed out on CI runners - testDispatcherCustomUrl: restore the static eventEndpoint so retries and later tests see the default - testConcurrentLogging(_MultipleLoggerInstances): allow 60s instead of 10s for 8000 os_log calls; the test checks for crashes, not speed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Muzahidul Islam (muzahidul-opti)
merged commit Oct 7, 2026
2d6d0d6
into
master
13 of 14 checks passed
Muzahidul Islam (muzahidul-opti)
deleted the
muzahid/fix-lrucache-threadsafe-test
branch
October 7, 2026 11:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes four flaky unit tests that failed by chance on CI. Each was turning
masteror PR runs red. Test code only, no SDK changes.LruCacheTests.testThreadSafeifrom the 3-slot cache betweensaveandlookup. That's correct LRU behavior, but the test expected the value to still be thereEventDispatcherTests.testDefaultDispatcherMockUrlSession). The real send → remove-from-queue path still runsEventDispatcherTests.testDispatcherCustomUrlEventForDispatch.eventEndpointand never restored it. Since #661, the built-in retry re-runs failed tests in the same process, so a retry of this test could never passdeferrestores the default endpointLoggerTests_MultiClients.testConcurrentLogging(+_MultipleLoggerInstances)os_logcalls had to finish within 10 s. Busy runners missed it: "Concurrent tasks timed out"Evidence
Failures on CI:
testThreadSafe: Apple TV failed onmaster, run 37580705312testDefaultDispatcher×3 andtestConcurrentLogging×2: iPhone Air failed on the first CI run of this PRLocal runs (
-run-tests-until-failure):Before:
testThreadSafefailed on iteration 1 of 50 on tvOS:("nil") is not equal to ("Optional(1820)")testDispatcherCustomUrlfailed on iteration 2: the endpoint leaked from iteration 1After:
LruCacheTestsEventDispatcherTestsEventDispatcherTests+LoggerTests_MultiClientsA slow CI runner can't be reproduced locally, so the logging timeout is only proven by CI.
Merge Danger
Door: two-way (test-only)
Blast Radius: 3 test files in the Common and MultiClients test targets. No SDK code changes.
Issues
🤖 Generated with Claude Code