Skip to content
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(tests): Fix a flaky test by marking a room's members as synced. #4534

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions crates/matrix-sdk-base/src/rooms/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,17 @@ impl Room {
self.inner.read().members_synced
}

/// Mark this Room as holding all member information.
///
/// Useful in tests if we want to persuade the Room not to sync when asked
/// about its members.
#[cfg(feature = "testing")]
pub fn mark_members_synced(&self) {
self.inner.update(|info| {
info.members_synced = true;
});
}

/// Mark this Room as still missing member information.
pub fn mark_members_missing(&self) {
self.inner.update_if(|info| {
Expand Down
2 changes: 2 additions & 0 deletions crates/matrix-sdk/src/room/identity_status_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,8 @@ mod tests {
.build_sync_response();
client.process_sync(create_room_sync_response).await.unwrap();
let room = client.get_room(&DEFAULT_TEST_ROOM_ID).expect("Room should exist");
room.inner.mark_members_synced();

assert_eq!(room.state(), RoomState::Joined);
assert_eq!(
*room
Expand Down
Loading