-
Notifications
You must be signed in to change notification settings - Fork 77
Description
Summary
The testCanStreamAllMessages test in sdks/android/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt is flaky and has been skipped with @Ignore.
Test Description
The test creates a group and a DM conversation, starts streaming all messages for boClient, sends one message to each conversation, then asserts exactly 2 messages were collected.
Failure Details
> Task :library:connectedDebugAndroidTest
org.xmtp.android.library.ConversationsTest > testCanStreamAllMessages[emulator-5560 - 14] FAILED
java.lang.AssertionError: expected:<2> but was:<3>
at org.junit.Assert.fail(Assert.java:89)
The stream collected 3 messages instead of the expected 2, indicating an extra message (likely a membership change or system message) was delivered to the stream.
Likely Cause
The streamAllMessages() stream may receive system/protocol messages (e.g., member added notifications) in addition to the two explicitly sent messages. The 1-second Thread.sleep delays are also timing-sensitive and may allow additional messages to arrive.
Current Mitigation
The test has been annotated with @Ignore("Flaky: stream collects extra messages non-deterministically") to prevent CI failures.
Resolution
- Investigate what the extra message is (system message, duplicate, or protocol event)
- Consider filtering by message type or adjusting the assertion to account for system messages
- Consider replacing
Thread.sleepwith a more deterministic synchronization mechanism
File
sdks/android/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt