-
Notifications
You must be signed in to change notification settings - Fork 33
[FSSDK-12240] fix flaky tests with proper synchronization #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Added CLAUDE.md file to provide context and guidelines for development: - Project overview and structure - Getting started guide with platform support and installation - Coding standards and common patterns (protocol-oriented design, thread safety) - Complete development workflow from branch creation to PR - Testing guide with xcodebuild commands and best practices - Key API usage examples - Helpful commands for file searching, testing, and git operations The documentation is organized logically from introduction to reference material for better developer onboarding and contribution experience. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Consolidated duplicate sections to improve readability: - Moved all testing commands to dedicated 'Testing' section - Kept linting info only in 'Coding Standards' - Consolidated git commands in 'Helpful Commands' - Added cross-references in 'Making Changes' workflow - Removed repeated commands from multiple locations This reduces redundancy and makes the guide easier to maintain. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixed multiple test failures and flaky tests across the test suite: 1. **CMAB Test Fixes** (OptimizelyUserContextTests_Decide_CMAB.swift): - Fixed testDecideAsync_cmabCacheOptions failing with "Expected 3 calls" - Root cause: CMAB cache persisting between tests causing cache hits - Solution: Reset cache in setUp/tearDown, use unique userId - Added thread-safe state tracking in MockCmabService - Added clarifying comments for variation IDs - Removed commented-out code 2. **Event Dispatcher Retry Tests** (EventDispatcherRetryTests.swift): - Fixed testRetry_AllAttemptsExhausted timing issues - Fixed testRetry_NetworkReachabilityDown synchronization - Replaced unreliable asyncAfter with notify.wait() for proper completion - Added setUp queue clearing to prevent test pollution 3. **JSON Encoding Determinism** (Utils.swift, OTUtils.swift): - Fixed testEncodeJSON failures on Xcode 16.x - Added .sortedKeys to JSONEncoder for deterministic key ordering - Updated expected JSON strings in DecisionServiceTests_Experiments - Updated expected JSON strings in OptimizelyUserContextTests_Decide_Reasons 4. **Event Dispatcher Batch Tests** (EventDispatcherTests_Batch.swift): - Fixed ArrayEventForDispatch extension edge cases - Improved batch processing test reliability 5. **CI Configuration** (swift.yml, unit_tests.yml): - Updated test runner configuration for better reliability All tests now pass reliably both individually and in the full suite. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
4e08078 to
f04e296
Compare
jaeopt
approved these changes
Jan 23, 2026
Contributor
jaeopt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
Test plan
Issues