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

test: Fix e2e test race condition by buffering events #12739

Merged
merged 7 commits into from
Jul 4, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Jul 3, 2024

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?

@lforst lforst requested a review from mydea July 3, 2024 11:45
@lforst lforst requested a review from AbhiPrasad July 3, 2024 15:32
@@ -247,49 +282,54 @@ export async function waitForPlainRequest(
/** Wait for a request to be sent. */
export async function waitForRequest(
proxyServerName: string,
timestamp: number,
Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah made it optional

Copy link
Member

@mydea mydea left a comment

Choose a reason for hiding this comment

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

sweet!

@lforst lforst merged commit 993acd4 into develop Jul 4, 2024
114 of 115 checks passed
@lforst lforst deleted the lforst-event-proxy-no-race-condition branch July 4, 2024 08:44
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