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

reflex/testmock: Add await consumer test util #13

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

andrewwormald
Copy link
Contributor

This MR adds a test util function that blocks until a consumer has consumed a specific / expected event (based on the event's ID).

The function uses the cursor store and polls it at a high frequency, as it should only be used in a test, to check and see if the consumer has consumed the event ID or has passed the event ID as reflex consumers expect events to have incrementing ID's.

This can be used in test cases where you need to test a consumer that you dont have direct control of such as when running a service test and allows for the test case to make assertions once the consumer has consumed the provided event.

@andrewwormald andrewwormald marked this pull request as ready for review September 12, 2024 09:14
Copy link
Contributor

@echarrod echarrod left a comment

Choose a reason for hiding this comment

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

Nice

Copy link

sonarcloud bot commented Sep 12, 2024

@andrewwormald andrewwormald self-assigned this Sep 12, 2024
@andrewwormald andrewwormald merged commit 6baef28 into main Sep 12, 2024
4 checks passed
@adamhicks adamhicks deleted the andreww-addAwaitConsumer branch October 28, 2024 09:29
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