forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kbn-test] error message if MFA is enabled for test account (elastic#…
…196906) ## Summary Recently few engineers reported issues when running FTR **locally** against MKI project on QA env. It turned out MFA was enabled for the test cloud accounts, that breaks automatic login to the Cloud. This PR checks response for `mfa_required: true` and fails without retrying asking to disable MFA for test account. --------- Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
0e1b2a3
commit 63ebd41
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,6 +168,36 @@ describe('saml_auth', () => { | |
'Failed to create the new cloud session, check retry arguments: {"attemptsCount":0,"attemptDelay":100}' | ||
); | ||
}); | ||
|
||
test(`should fail without retry when response has 'mfa_required: true'`, async () => { | ||
axiosRequestMock.mockImplementation((config: AxiosRequestConfig) => { | ||
if (config.url?.endsWith('/api/v1/saas/auth/_login')) { | ||
return Promise.resolve({ | ||
data: { user_id: 12345, authenticated: false, mfa_required: true }, | ||
status: 200, | ||
}); | ||
} | ||
return Promise.reject(new Error(`Unexpected URL: ${config.url}`)); | ||
}); | ||
|
||
await expect( | ||
createCloudSession( | ||
{ | ||
hostname: 'cloud', | ||
email: '[email protected]', | ||
password: 'changeme', | ||
log, | ||
}, | ||
{ | ||
attemptsCount: 3, | ||
attemptDelay: 100, | ||
} | ||
) | ||
).rejects.toThrow( | ||
'Failed to create the new cloud session: MFA must be disabled for the test account' | ||
); | ||
expect(axiosRequestMock).toBeCalledTimes(1); | ||
}); | ||
}); | ||
|
||
describe('createSAMLRequest', () => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters