mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-03-12 18:07:10 -04:00
fix: action fails when intending to use existing credentials (#796)
* fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials * fix: action fails when intending to use existing credentials --------- Co-authored-by: Tom Keller <1083460+kellertk@users.noreply.github.com>
This commit is contained in:
@@ -519,13 +519,33 @@ describe('Configure AWS Credentials', () => {
|
||||
await run();
|
||||
|
||||
expect(core.info).toHaveBeenCalledWith(
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission?'
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission?' +
|
||||
' If you are not trying to authenticate with OIDC and the action is working successfully, you can ignore this message.'
|
||||
);
|
||||
expect(core.setFailed).toHaveBeenCalledWith(
|
||||
'Could not determine how to assume credentials. Please check your inputs and try again.'
|
||||
);
|
||||
});
|
||||
|
||||
test('Assume role with existing credentials if nothing else set', async () => {
|
||||
process.env['AWS_ACCESS_KEY_ID'] = FAKE_ACCESS_KEY_ID;
|
||||
process.env['AWS_SECRET_ACCESS_KEY'] = FAKE_SECRET_ACCESS_KEY;
|
||||
jest.spyOn(core, 'getInput').mockImplementation(
|
||||
mockGetInput({
|
||||
'role-to-assume': ROLE_ARN,
|
||||
'aws-region': FAKE_REGION,
|
||||
})
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(core.info).toHaveBeenCalledWith(
|
||||
'It looks like you might be trying to authenticate with OIDC. Did you mean to set the `id-token` permission?' +
|
||||
' If you are not trying to authenticate with OIDC and the action is working successfully, you can ignore this message.'
|
||||
);
|
||||
expect(mockedSTS.commandCalls(AssumeRoleCommand).length).toEqual(1);
|
||||
});
|
||||
|
||||
test('role assumption fails after maximum trials using OIDC provider', async () => {
|
||||
process.env['GITHUB_ACTIONS'] = 'true';
|
||||
process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'] = 'test-token';
|
||||
|
||||
Reference in New Issue
Block a user