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 flaky pollDebounce tests #72

Merged
merged 2 commits into from
Mar 24, 2016
Merged

Fix flaky pollDebounce tests #72

merged 2 commits into from
Mar 24, 2016

Conversation

avital
Copy link
Contributor

@avital avital commented Mar 24, 2016

The pollDebounce tests insert 10 documents and make sure
that debouncing leads to two separate chunks of documents
being passed through the 'insert' callback on the query.

The problem was that we weren't waiting for the document
creation to be submitted before sending the next document.

Even though the original test behavior was a more accurate
representation of what a real client would do, it lead to
unpredictable results. The timing of when the op was submitted
could have lead to all of the documents being added in one single
chunk, rather than two.

While at it, made the test more strict -- it now checks the sizes
of the two chunks passed through the 'insert' callback, rather
than just the number of chunks.

Instead of just checking whether there are 2 batches of documents passed through the
'insert' event, make sure we get exactly 1 document in the first batch and the rest of them
(9) in the second batch.
The pollDebounce tests insert 10 documents and make sure
that debouncing leads to two separate chunks of documents
being passed through the 'insert' callback on the query.

The problem was that we weren't waiting for the document
creation to be submitted before sending the next document.

Even though the original test behavior was a more accurate
representation of what a real client would do, it lead to
unpredictable results. The timing of when the op was submitted
could have lead to all of the documents being added in one single
chunk, rather than two.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.116% when pulling 920d4b8 on avital:fix-poll-debounce-tests into 3d12089 on share:master.

@nateps
Copy link
Contributor

nateps commented Mar 24, 2016

Yep, looks great. Thanks!

@nateps nateps merged commit a06d343 into share:master Mar 24, 2016
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.

None yet

3 participants