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 erratic livequery tests. #2095

Merged
merged 1 commit into from
Nov 15, 2024
Merged

Conversation

dfahlander
Copy link
Collaborator

@dfahlander dfahlander commented Nov 13, 2024

In the unit tests for liveQuery, change how we wait until an expected result is emitted from a live query. Current tests were more prone to timing issues and race conditions. Now we instead do the following for those tests:

  1. Define the expected results
  2. Subscribe to live query and wait until the expected results arrive, or a timeout of 500 ms happens.

The thing is that liveQueries might emit a previous result at first, so by ignoring temporary outdated results we're not prone to timing issues except for the theoretical situtation that a liveQuery would take more than 500ms to emit expected result - which is practically irrellevant on the hardwares and queries we test.

Change how we wait until an expected result is emitted from a live query.
Current tests were more prone to timing issues and race conditions. Now we instead do the following for those tests:
1. Define the expected results
2. Subscribe to live query and wait until the expected results arrive, or a timeout of 500 ms happens.

The thing is that liveQueries might emit a previous result at first, so by ignoring temporary outdated results we're not prone to timing issues.
@dfahlander dfahlander merged commit 7ec8ce3 into master Nov 15, 2024
5 checks passed
@dfahlander dfahlander deleted the fix-erratic-livequery-tests branch November 15, 2024 15:52
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.

1 participant