Skip to content

Commit

Permalink
fix: ensure AWS_REGION matches CLI_REGION in all tests (#12837)
Browse files Browse the repository at this point in the history
* chore: noop trigger cb

* chore: noop trigger cb

* chore: add beforeeach to other setup-tests files
  • Loading branch information
goldbez committed Jun 23, 2023
1 parent fd18195 commit 7be43e4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/amplify-console-integration-tests/src/setup-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ removeYarnPaths();

const JEST_TIMEOUT = 1000 * 60 * 60; // 1 hour
jest.setTimeout(JEST_TIMEOUT);

beforeEach(async () => {
if (process.env.CLI_REGION) {
console.log(`CLI_REGION set to: ${process.env.CLI_REGION}. Overwriting AWS_REGION and AWS_DEFAULT_REGION`);
process.env.AWS_REGION = process.env.CLI_REGION;
process.env.AWS_DEFAULT_REGION = process.env.CLI_REGION;
} else {
console.log('No CLI_REGION variable found');
}
});
10 changes: 10 additions & 0 deletions packages/amplify-e2e-tests/src/setup-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ jest.setTimeout(JEST_TIMEOUT);
if (process.env.CIRCLECI) {
jest.retryTimes(1);
}

beforeEach(async () => {
if (process.env.CLI_REGION) {
console.log(`CLI_REGION set to: ${process.env.CLI_REGION}. Overwriting AWS_REGION and AWS_DEFAULT_REGION`);
process.env.AWS_REGION = process.env.CLI_REGION;
process.env.AWS_DEFAULT_REGION = process.env.CLI_REGION;
} else {
console.log('No CLI_REGION variable found');
}
});
10 changes: 10 additions & 0 deletions packages/amplify-migration-tests/src/setup-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ jest.setTimeout(JEST_TIMEOUT);
if (process.env.CIRCLECI) {
jest.retryTimes(1);
}

beforeEach(async () => {
if (process.env.CLI_REGION) {
console.log(`CLI_REGION set to: ${process.env.CLI_REGION}. Overwriting AWS_REGION and AWS_DEFAULT_REGION`);
process.env.AWS_REGION = process.env.CLI_REGION;
process.env.AWS_DEFAULT_REGION = process.env.CLI_REGION;
} else {
console.log('No CLI_REGION variable found');
}
});

0 comments on commit 7be43e4

Please sign in to comment.