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(flaky): fix unresolved promise causing linux failures #6088

Merged

Conversation

Hweinstock
Copy link
Contributor

@Hweinstock Hweinstock commented Nov 22, 2024

Problem

#6043
To reproduce, add a 5 second delay to the after hook at the top level.
One way to do this is to insert this at line 84.

after(async function () {
        clock.uninstall()
        await sleep(5000)
    })

Despite asserting that the promise rejects within the test, the promise rejects after the test as well. Not entirely sure why this happening.

  • Tried manually wrapping in try-catch with an await instead of assert.rejects and it still fails.
  • Tried wrapping the promise in another promise before passing to assert.rejects.

Solution

What does appear to work, is manually handling the callback of the promise. That is, explicitly defining a then and catch method to assert the rejection, and awaiting the promise at the end of the test to ensure it resolves before the test finishes. Not sure why this works, but I am unable to reproduce the error with this change.

Notes


License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@Hweinstock Hweinstock marked this pull request as ready for review November 22, 2024 17:20
@Hweinstock Hweinstock requested a review from a team as a code owner November 22, 2024 17:20
Copy link
Contributor

@justinmk3 justinmk3 left a comment

Choose a reason for hiding this comment

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

Nice!

@justinmk3
Copy link
Contributor

justinmk3 commented Nov 27, 2024

This should allow use to remove Timed-out waiting for browser login flow\| from this ignore-pattern, now:

_ignore_pat='Timed-out waiting for browser login flow\|HTTPError: Response code 403\|HTTPError: Response code 404\|npm WARN deprecated querystring\|npm WARN deprecated'

Let's include that with this commit, since they are inherently coupled.

@Hweinstock Hweinstock changed the base branch from master to feature/postreinvent December 4, 2024 19:48
@Hweinstock Hweinstock merged commit c8bfe2f into aws:feature/postreinvent Dec 4, 2024
32 of 34 checks passed
@Hweinstock Hweinstock deleted the fixUnresolvedPromise branch December 4, 2024 22:56
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