-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
test: Fix e2e test race condition by buffering events #12739
Conversation
@@ -247,49 +282,54 @@ export async function waitForPlainRequest( | |||
/** Wait for a request to be sent. */ | |||
export async function waitForRequest( | |||
proxyServerName: string, | |||
timestamp: number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: Can we make this optional, as third argument, and just default to Date.now()
? I guess we'll want this like this basically always? 😅 (same for the other methods)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah made it optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet!
Co-authored-by: Francesco Novy <[email protected]>
Makes e2e tests less flakey by adding an event buffer that is used to send events to callback listeners that have not managed to connect in time for a particular events.
We do this by letting the event listeners also send along a timestamp from which point onwards they would like to receive events.
The race condition would have happened when a listener is registered and an event is triggered right after, meaning the event would escape the provided callback because the listener hasn't connected yet. Slim chance but happens.
We will consume more memory by buffering but it is hopefully managable. GH runners are free right?