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

Add a test for paginated search results #110

Merged
merged 3 commits into from
Dec 17, 2015
Merged

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Dec 17, 2015

This tests the fix added at matrix-org/synapse#447

@richvdh
Copy link
Member Author

richvdh commented Dec 17, 2015

... and it fails because the fix isn't on develop yet.


my $results = $room_events->{results};
scalar @$results == 10 or die "Expected 10 search results";
$results->[0]{result}{event_id} eq $event_ids[19]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These can be done with

assert_eq( $results->[0]{result}{event_id}, $event_ids[19],
   'first result event_id' );

which prints the expected/actual values on failure

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's new!

Done.

@leonerd
Copy link
Contributor

leonerd commented Dec 17, 2015

Overall: the test appears to be expecting that search results come in batches of 10 each, but the search parameters didn't request exactly 10. This feels like it's a fragile assumption of implementation. Is there perhaps a limit parameter that can be specified?

Set the limit on the search query. Other minor cleanups.
@richvdh
Copy link
Member Author

richvdh commented Dec 17, 2015

good point about the implicit limit. Now made explicit.

@leonerd
Copy link
Contributor

leonerd commented Dec 17, 2015

LGTM

@richvdh
Copy link
Member Author

richvdh commented Dec 17, 2015

ta

richvdh added a commit that referenced this pull request Dec 17, 2015
Add a test for paginated search results
@richvdh richvdh merged commit 73369e8 into develop Dec 17, 2015
@richvdh richvdh deleted the rav/test_search_pagination branch December 17, 2015 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants