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 the timeout logic in the waitForEvent integration test helper function #18325

Merged

Conversation

timvandermeij
Copy link
Contributor

@timvandermeij timvandermeij commented Jun 24, 2024

Debugging #17931, by printing all parts of the event lifecycle including timestamps, uncovered that some events for which a timeout was logged actually did get triggered correctly in the browser. Going over the code and discovering https://stackoverflow.com/questions/47107465/puppeteer-how-to-listen-to-object-events#comment117661238_65534026 showed what went wrong: if the event we wait for is triggered then Promise.race resolves, but that doesn't automatically cancel the timeout. The tests didn't fail on this because Promise.race resolved correctly, but slightly later once the timeout was reached we would see spurious log lines about timeouts for the already-triggered events.

This commit fixes the issue by canceling the timeout if the event we're waiting for has triggered.

Note that this patch gets rid of the incorrect timeout logs, but this doesn't solve the problem of the correct timeout logs yet (but it's preparatory work for follow-up patches that address that problem).

Fixes a part of #17931.

…unction

Debugging mozilla#17931, by printing all parts of the event lifecycle including
timestamps, uncovered that some events for which a timeout was logged
actually did get triggered correctly in the browser. Going over the code
and discovering https://stackoverflow.com/questions/47107465/puppeteer-how-to-listen-to-object-events#comment117661238_65534026
showed what went wrong: if the event we wait for is triggered then
`Promise.race` resolves, but that doesn't automatically cancel the
timeout. The tests didn't fail on this because `Promise.race` resolved
correctly, but slightly later once the timeout was reached we would see
spurious log lines about timeouts for the already-triggered events.

This commit fixes the issue by canceling the timeout if the event we're
waiting for has triggered.
@timvandermeij timvandermeij changed the title Fix the timeout logic in the waitForEvent integration test helper f… Fix the timeout logic in the waitForEvent integration test helper function Jun 24, 2024
@timvandermeij
Copy link
Contributor Author

/botio integrationtest

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.193.163.58:8877/28d99334c8f3d5e/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @timvandermeij received. Current queue size: 0

Live output at: http://54.241.84.105:8877/d8e7a6b9abae7b1/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/d8e7a6b9abae7b1/output.txt

Total script time: 7.76 mins

  • Integration Tests: FAILED

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/28d99334c8f3d5e/output.txt

Total script time: 19.12 mins

  • Integration Tests: Passed

Copy link
Collaborator

@Snuffleupagus Snuffleupagus left a comment

Choose a reason for hiding this comment

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

r=me, thank you!

@timvandermeij timvandermeij merged commit 4b95d68 into mozilla:master Jun 25, 2024
7 checks passed
@timvandermeij timvandermeij deleted the integration-test-timeouts branch June 25, 2024 11:44
@timvandermeij timvandermeij removed the request for review from calixteman June 25, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants