Skip to content

Commit

Permalink
Regression test for sync cache consistency bug (#718)
Browse files Browse the repository at this point in the history
(though note also that this requires synapse to run in worker mode, with some
replication-torturing patches, to show up the issue.)
  • Loading branch information
richvdh authored Oct 9, 2019
1 parent a26449f commit b699f7e
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/31sync/07invited.pl
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,51 @@
Future->done(1);
})
};


test "Newly joined room is included in an incremental sync after invite",
# matrix-org/synapse#4422
requires => [
local_user_and_room_fixtures(),
local_user_fixture( with_events => 0 ),
qw( can_sync ),
],

check => sub {
my ( $creator, $room_id, $user ) = @_;

matrix_sync( $user )->then( sub {
matrix_invite_user_to_room_synced(
$creator, $user, $room_id,
);
})->then( sub {
matrix_sync_again( $user );
})->then( sub {
my ( $body ) = @_;
log_if_fail "post-invite sync", $body;

my $room = $body->{rooms}{invite}{$room_id};
assert_json_keys( $room, qw( invite_state ) );
assert_json_keys( $room->{invite_state}, qw( events ) );

# accept the invite
matrix_join_room( $user, $room_id );
})->then( sub {
# wait for the sync to turn up
await_sync( $user,
check => sub {
return $_[0]->{rooms}{join}{$room_id};
},
);
})->then( sub {
my ( $room ) = @_;
log_if_fail "post-join sync", $room;

assert_json_keys( $room, qw( timeline state ephemeral ));
assert_json_keys( $room->{timeline}, qw( events limited prev_batch ));
assert_json_keys( $room->{state}, qw( events ));
assert_json_keys( $room->{ephemeral}, qw( events ));

Future->done(1);
})
};

0 comments on commit b699f7e

Please sign in to comment.