Skip to content

Commit

Permalink
test: E2E test stability improvements (#2677)
Browse files Browse the repository at this point in the history
* test: fix await for SSL cert upload
* test: do not remove linebreaks in custom SSL cert
* test: add authv2transformer tests to RUN_IN_COGNITO_REGIONS
  • Loading branch information
palpatim authored Jul 1, 2024
1 parent 9570015 commit f3bf86d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('Custom SSL certificates', () => {
// keep the certs in sync.
const sslCertFilesystemPath = path.resolve(path.join(__dirname, 'rds-bundles', `${region}-bundle.pem`));
sslCertSsmPath = `/amplify/integtest/${prefix}/${disambiguator}`;
const version = uploadSslCertAtPathToSsm(sslCertFilesystemPath, region, sslCertSsmPath);
const version = await uploadSslCertAtPathToSsm(sslCertFilesystemPath, region, sslCertSsmPath);
console.log(`Uploaded cert to SSM at ${sslCertSsmPath} (version ${version})`);

const strategy = dbDetailsToModelDataSourceStrategy(dbDetails, prefix, 'MYSQL', 'secretsManagerManagedSecret');
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('Custom SSL certificates', () => {
// We will use a self-signed cert as the only SSL cert in the trust chain, and expect a connection failure
const sslCertFilesystemPath = path.resolve(path.join(__dirname, 'self-signed-ca-cert.pem'));
sslCertSsmPath = `/amplify/integtest/${prefix}/${disambiguator}`;
const version = uploadSslCertAtPathToSsm(sslCertFilesystemPath, region, sslCertSsmPath);
const version = await uploadSslCertAtPathToSsm(sslCertFilesystemPath, region, sslCertSsmPath);
console.log(`Uploaded cert to SSM at ${sslCertSsmPath} (version ${version})`);

const strategy = dbDetailsToModelDataSourceStrategy(dbDetails, prefix, 'MYSQL', 'secretsManagerManagedSecret');
Expand Down Expand Up @@ -168,8 +168,7 @@ describe('Custom SSL certificates', () => {
* @returns The version of the uploaded SSM parameter
*/
const uploadSslCertAtPathToSsm = async (sslCertFilesystemPath: string, region: string, sslCertSsmPath: string): Promise<number> => {
const sslCertWithLineBreaks = fs.readFileSync(sslCertFilesystemPath).toString();
const sslCert = sslCertWithLineBreaks.replace(/\n/g, '');
const sslCert = fs.readFileSync(sslCertFilesystemPath).toString();
const ssmClient = new SSMClient({ region: region });
const command = new PutParameterCommand({
Name: sslCertSsmPath,
Expand Down
4 changes: 4 additions & 0 deletions scripts/split-e2e-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ const RUN_IN_COGNITO_REGIONS: (string | RegExp)[] = [
/src\/__tests__\/group-auth\/.*\.test\.ts/,
/src\/__tests__\/owner-auth\/.*\.test\.ts/,
/src\/__tests__\/restricted-field-auth\/.*\.test\.ts/,
/src\/__tests__\/RelationalWithAuthV2NonRedacted.e2e.test.ts/,
/src\/__tests__\/AuthV2TransformerIAM.test.ts/,
/src\/__tests__\/AuthV2ExhaustiveT3D.test.ts/,
/src\/__tests__\/AuthV2ExhaustiveT3C.test.ts/,
];

const RUN_IN_V1_TRANSFORMER_REGIONS = ['src/__tests__/schema-searchable.test.ts'];
Expand Down

0 comments on commit f3bf86d

Please sign in to comment.