mirror of
https://github.com/aws-actions/configure-aws-credentials.git
synced 2026-09-03 06:05:04 +09:00
Revert "Merge branch 'master' into v1-node16"
This reverts commitdf03f9f89e, reversing changes made to5f641521a3.
This commit is contained in:
+1
-71
@@ -2,7 +2,6 @@ const core = require('@actions/core');
|
||||
const assert = require('assert');
|
||||
const aws = require('aws-sdk');
|
||||
const { run, withSleep, reset } = require('./index.js');
|
||||
const proxy = require('https-proxy-agent');
|
||||
|
||||
jest.mock('@actions/core');
|
||||
|
||||
@@ -34,7 +33,6 @@ function mockGetInput(requestResponse) {
|
||||
return requestResponse[name]
|
||||
}
|
||||
}
|
||||
|
||||
const CREDS_INPUTS = {
|
||||
'aws-access-key-id': FAKE_ACCESS_KEY_ID,
|
||||
'aws-secret-access-key': FAKE_SECRET_ACCESS_KEY
|
||||
@@ -54,8 +52,7 @@ const mockStsAssumeRoleWithWebIdentity = jest.fn();
|
||||
jest.mock('aws-sdk', () => {
|
||||
return {
|
||||
config: {
|
||||
getCredentials: jest.fn(),
|
||||
update: jest.fn(),
|
||||
getCredentials: jest.fn()
|
||||
},
|
||||
STS: jest.fn(() => ({
|
||||
getCallerIdentity: mockStsCallerIdentity,
|
||||
@@ -130,9 +127,6 @@ describe('Configure AWS Credentials', () => {
|
||||
callback(null);
|
||||
});
|
||||
|
||||
aws.config.update.mockReset();
|
||||
aws.config.update.mockImplementationOnce();
|
||||
|
||||
mockStsAssumeRole.mockImplementation(() => {
|
||||
return {
|
||||
promise() {
|
||||
@@ -810,68 +804,4 @@ describe('Configure AWS Credentials', () => {
|
||||
await run();
|
||||
});
|
||||
|
||||
describe('proxy settings', () => {
|
||||
|
||||
test('setting proxy with actions input', async () => {
|
||||
const EXPECTED_PROXY = 'http://test.me'
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
mockGetInput({ ...DEFAULT_INPUTS, 'http-proxy': EXPECTED_PROXY })
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(aws.config.update).toHaveBeenCalledTimes(1);
|
||||
expect(aws.config.update).toHaveBeenCalledWith({
|
||||
httpOptions: { agent: proxy(EXPECTED_PROXY) }
|
||||
});
|
||||
});
|
||||
test('setting proxy from environment vars', async () => {
|
||||
const EXPECTED_PROXY = 'http://test.me'
|
||||
process.env.HTTP_PROXY = EXPECTED_PROXY;
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
mockGetInput({ ...DEFAULT_INPUTS })
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(aws.config.update).toHaveBeenCalledTimes(1);
|
||||
expect(aws.config.update).toHaveBeenCalledWith({
|
||||
httpOptions: { agent: proxy(EXPECTED_PROXY) }
|
||||
});
|
||||
});
|
||||
|
||||
test('setting proxy - prefer action input', async () => {
|
||||
const EXPECTED_PROXY = 'http://test.me'
|
||||
const FALSE_PROXY = 'http://env.me'
|
||||
process.env.HTTP_PROXY = FALSE_PROXY;
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
mockGetInput({ ...DEFAULT_INPUTS, 'http-proxy': EXPECTED_PROXY })
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(aws.config.update).toHaveBeenCalledTimes(1);
|
||||
expect(aws.config.update).toHaveBeenCalledWith({
|
||||
httpOptions: { agent: proxy(EXPECTED_PROXY) }
|
||||
});
|
||||
});
|
||||
|
||||
test('ignoring proxy - without anything set', async () => {
|
||||
core.getInput = jest
|
||||
.fn()
|
||||
.mockImplementation(
|
||||
mockGetInput({ ...DEFAULT_INPUTS})
|
||||
);
|
||||
|
||||
await run();
|
||||
|
||||
expect(aws.config.update).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user