Skip to content

Flaky test: testSyncConsent in Android HistorySyncTest #3162

@neekolas

Description

@neekolas

Summary

The testSyncConsent test in sdks/android/library/src/androidTest/java/org/xmtp/android/library/HistorySyncTest.kt is flaky and has been skipped with @Ignore.

Test Description

The test creates a group via boClient, syncs it to alixClient, verifies the initial consent state is UNKNOWN, then creates a second installation (alixClient2). After syncing, it updates the group's consent state to DENIED on alixClient and expects the state to propagate to alixClient2 after a delay.

Failure Details

> Task :library:connectedDebugAndroidTest
org.xmtp.android.library.HistorySyncTest > testSyncConsent[emulator-5560 - 14] FAILED 
    java.lang.AssertionError: expected:<UNKNOWN> but was:<DENIED>
    at org.junit.Assert.fail(Assert.java:89)

The initial consent state of the group on alixClient is expected to be UNKNOWN but is already DENIED, suggesting the consent state was set earlier than expected during the sync.

Likely Cause

The consent sync between installations relies on timing-sensitive operations (preferences.sync() with fixed delays). The consent state may propagate faster than expected, arriving before the initial assertion checks.

Current Mitigation

The test has been annotated with @Ignore("Flaky: consent sync timing is non-deterministic") to prevent CI failures.

Resolution

  • Investigate why the consent state is DENIED before the test expects it to be
  • Consider using a callback/stream-based approach instead of fixed delays to detect consent changes
  • Ensure the timing assumptions in the test match the actual sync behavior

File

sdks/android/library/src/androidTest/java/org/xmtp/android/library/HistorySyncTest.kt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions