-
-
Notifications
You must be signed in to change notification settings - Fork 97
Fix state matching logic in AndroidSyncFrameworkTest #1708
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
Fix state matching logic in AndroidSyncFrameworkTest #1708
Conversation
75ada59
to
6a6df4c
Compare
6a6df4c
to
3c0dc34
Compare
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.
Pull Request Overview
This PR fixes test flakiness in AndroidSyncFrameworkTest
by improving the state matching logic to properly handle optional sync states during partial and full comparisons.
- Refactored state assertion logic by separating comparison from error handling
- Added a
fullMatch
parameter to control whether all expected states must be matched - Added validation to ensure the last expected state is non-optional
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
app/src/androidTest/kotlin/at/bitfire/davdroid/sync/AndroidSyncFrameworkTest.kt
Show resolved
Hide resolved
app/src/androidTest/kotlin/at/bitfire/davdroid/sync/AndroidSyncFrameworkTest.kt
Show resolved
Hide resolved
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.
Context is not used, so we don't need to inject it. Furthermore no mocks are used so we don't need the mock rule. Looks good to me otherwise though.
app/src/androidTest/kotlin/at/bitfire/davdroid/sync/AndroidSyncFrameworkTest.kt
Outdated
Show resolved
Hide resolved
- Add `fullMatch` parameter to control whether all expected states must be present
- Update `onStatusChanged` to override the interface method. - Replace custom assertion with `assertTrue` for state comparison.
468eb7b
to
a7ba1af
Compare
Purpose
Currently test runs are randomly failing because
AndroidSyncFrameworkTest
doesn't correctly take optional sync states into account.Short description
This PR optimizes handling of partial state comparision and adds a "full match required" flag that disables partial state comparision.
Checklist