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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -310,27 +310,29 @@ describe('SsoAccessTokenProvider', function () {
})

it('respects the device authorization expiration time', async function () {
// XXX: Don't know how to fix this "unhandled rejection" caused by this test:
// rejected promise not handled within 1 second: Error: Timed-out waiting for browser login flow to complete
// at poll (…/src/auth/sso/ssoAccessTokenProvider.ts:251:15)
// at async SsoAccessTokenProvider.authorize (…/src/auth/sso/ssoAccessTokenProvider.ts:188:23)
// at async SsoAccessTokenProvider.runFlow (…/src/auth/sso/ssoAccessTokenProvider.ts:113:20)
// at async SsoAccessTokenProvider.createToken (…/src/auth/sso/ssoAccessTokenProvider.ts:102:24)

setupFlow()
stubOpen()
const exception = new AuthorizationPendingException({ message: '', $metadata: {} })
const authorization = createAuthorization(1000)
oidcClient.createToken.rejects(exception)
oidcClient.startDeviceAuthorization.resolves(authorization)

const resp = sut.createToken()
const resp = sut
.createToken()
.then(() => assert.fail('Should not resolve'))
.catch((e) => {
assert.ok(
e instanceof ToolkitError &&
e.message === 'Timed-out waiting for browser login flow to complete'
)
})

const progress = await getTestWindow().waitForMessage(/login page opened/i)
await clock.tickAsync(750)
assert.ok(progress.visible)
await clock.tickAsync(750)
assert.ok(!progress.visible)
await assert.rejects(resp, ToolkitError)
await resp
assertTelemetry('aws_loginWithBrowser', {
result: 'Failed',
isReAuth: undefined,
Expand Down
Loading