Skip to content

Commit

Permalink
Fix tests of /initialSync to work when the response is being cached
Browse files Browse the repository at this point in the history
Work around the changes in matrix-org/synapse#457
  • Loading branch information
NegativeMjark authored and review.rocks committed Dec 23, 2015
1 parent 7385908 commit 6945bee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion tests/10apidoc/30room-create.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
my $user_fixture = local_user_fixture();

# An incrementing parameter for initialSync to defeat the caching mechanism and ensure fresh results every time
my $initial_sync_limit = 1;

test "POST /createRoom makes a public room",
requires => [ $user_fixture,
qw( can_initial_sync )],
Expand Down Expand Up @@ -32,7 +35,8 @@
check => sub {
my ( $user ) = @_;

matrix_initialsync( $user )->then( sub {
# Change the limit for each request to defeat caching
matrix_initialsync( $user, limit => $initial_sync_limit++ )->then( sub {
my ( $body ) = @_;

assert_json_list( $body->{rooms} );
Expand Down
9 changes: 6 additions & 3 deletions tests/30rooms/21receipts.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use List::Util qw( first );

# An incrementing parameter for initialSync to defeat the caching mechanism and ensure fresh results every time
my $initial_sync_limit = 1;

sub find_receipt
{
my ( $body, %args ) = @_;
Expand Down Expand Up @@ -48,7 +51,7 @@ sub find_receipt

matrix_advance_room_receipt( $user, $room_id, "m.read" => $member_event_id )
})->then( sub {
matrix_initialsync( $user )
matrix_initialsync( $user, limit => $initial_sync_limit++ ); # Change the limit to defeat caching
})->then( sub {
my ( $body ) = @_;

Expand Down Expand Up @@ -78,7 +81,7 @@ sub find_receipt

matrix_advance_room_receipt( $user, $room_id, "m.read" => $message_event_id );
})->then( sub {
matrix_initialsync( $user );
matrix_initialsync( $user, limit => $initial_sync_limit++ ); # Change the limit to defeat caching
})->then( sub {
my ( $body ) = @_;

Expand All @@ -96,7 +99,7 @@ sub find_receipt
# Now lets check that they are monotonically racheted
matrix_advance_room_receipt( $user, $room_id, "m.read" => $member_event_id );
})->then( sub {
matrix_initialsync( $user );
matrix_initialsync( $user, limit => $initial_sync_limit++ ); # Change the limit to defeat caching
})->then( sub {
my ( $body ) = @_;

Expand Down

0 comments on commit 6945bee

Please sign in to comment.