Skip to content

Commit

Permalink
Merge branch 'main' into env-deploy-method
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Feb 9, 2024
2 parents c306f63 + 0efc6ae commit 2b60f66
Show file tree
Hide file tree
Showing 82 changed files with 7,064 additions and 171 deletions.
8 changes: 0 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ Closes #<issue number here>.
### Checklist
- [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

<!--Does this PR includes breaking changes? If it does, list them here in the following format (notice how multiple breaking changes should be formatted):
```
BREAKING CHANGE: Description of the breaking change, the previous behaviour, and the new behaviour.
* **module-name:** Another breaking change
* **module-name:** Yet another breaking change
```
-->
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Original file line number Diff line number Diff line change
Expand Up @@ -599,76 +599,76 @@ integTest('cdk migrate generates migrate.json', withCDKMigrateFixture('typescrip
await fixture.cdkDestroy(fixture.stackNamePrefix);
}));

integTest('cdk migrate --from-scan with AND/OR filters correctly filters resources', withExtendedTimeoutFixture(async (fixture) => {
const stackName = `cdk-migrate-integ-${fixture.randomString}`;

await fixture.cdkDeploy('migrate-stack', {
modEnv: { SAMPLE_RESOURCES: '1' },
});
await fixture.cdk(
['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::SNS::Topic,tag-key=tag1', 'type=AWS::SQS::Queue,tag-key=tag3'],
{ modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
);

try {
const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
GeneratedTemplateName: stackName,
});
const resourceNames = [];
for (const resource of response.Resources || []) {
if (resource.LogicalResourceId) {
resourceNames.push(resource.LogicalResourceId);
}
}
fixture.log(`Resources: ${resourceNames}`);
expect(resourceNames.some(ele => ele && ele.includes('migratetopic1'))).toBeTruthy();
expect(resourceNames.some(ele => ele && ele.includes('migratequeue1'))).toBeTruthy();
} finally {
await fixture.cdkDestroy('migrate-stack');
await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
GeneratedTemplateName: stackName,
});
}
}));

integTest('cdk migrate --from-scan for resources with Write Only Properties generates warnings', withExtendedTimeoutFixture(async (fixture) => {
const stackName = `cdk-migrate-integ-${fixture.randomString}`;

await fixture.cdkDeploy('migrate-stack', {
modEnv: {
LAMBDA_RESOURCES: '1',
},
});
await fixture.cdk(
['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::Lambda::Function,tag-key=lambda-tag'],
{ modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
);

try {

const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
GeneratedTemplateName: stackName,
});
const resourceNames = [];
for (const resource of response.Resources || []) {
if (resource.LogicalResourceId && resource.ResourceType === 'AWS::Lambda::Function') {
resourceNames.push(resource.LogicalResourceId);
}
}
fixture.log(`Resources: ${resourceNames}`);
const readmePath = path.join(fixture.integTestDir, stackName, 'README.md');
const readme = await fs.readFile(readmePath, 'utf8');
expect(readme).toContain('## Warnings');
for (const resourceName of resourceNames) {
expect(readme).toContain(`### ${resourceName}`);
}
} finally {
await fixture.cdkDestroy('migrate-stack');
await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
GeneratedTemplateName: stackName,
});
}
}));
// integTest('cdk migrate --from-scan with AND/OR filters correctly filters resources', withExtendedTimeoutFixture(async (fixture) => {
// const stackName = `cdk-migrate-integ-${fixture.randomString}`;

// await fixture.cdkDeploy('migrate-stack', {
// modEnv: { SAMPLE_RESOURCES: '1' },
// });
// await fixture.cdk(
// ['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::SNS::Topic,tag-key=tag1', 'type=AWS::SQS::Queue,tag-key=tag3'],
// { modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
// );

// try {
// const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
// GeneratedTemplateName: stackName,
// });
// const resourceNames = [];
// for (const resource of response.Resources || []) {
// if (resource.LogicalResourceId) {
// resourceNames.push(resource.LogicalResourceId);
// }
// }
// fixture.log(`Resources: ${resourceNames}`);
// expect(resourceNames.some(ele => ele && ele.includes('migratetopic1'))).toBeTruthy();
// expect(resourceNames.some(ele => ele && ele.includes('migratequeue1'))).toBeTruthy();
// } finally {
// await fixture.cdkDestroy('migrate-stack');
// await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
// GeneratedTemplateName: stackName,
// });
// }
// }));

// integTest('cdk migrate --from-scan for resources with Write Only Properties generates warnings', withExtendedTimeoutFixture(async (fixture) => {
// const stackName = `cdk-migrate-integ-${fixture.randomString}`;

// await fixture.cdkDeploy('migrate-stack', {
// modEnv: {
// LAMBDA_RESOURCES: '1',
// },
// });
// await fixture.cdk(
// ['migrate', '--stack-name', stackName, '--from-scan', 'new', '--filter', 'type=AWS::Lambda::Function,tag-key=lambda-tag'],
// { modEnv: { MIGRATE_INTEG_TEST: '1' }, neverRequireApproval: true, verbose: true, captureStderr: false },
// );

// try {

// const response = await fixture.aws.cloudFormation('describeGeneratedTemplate', {
// GeneratedTemplateName: stackName,
// });
// const resourceNames = [];
// for (const resource of response.Resources || []) {
// if (resource.LogicalResourceId && resource.ResourceType === 'AWS::Lambda::Function') {
// resourceNames.push(resource.LogicalResourceId);
// }
// }
// fixture.log(`Resources: ${resourceNames}`);
// const readmePath = path.join(fixture.integTestDir, stackName, 'README.md');
// const readme = await fs.readFile(readmePath, 'utf8');
// expect(readme).toContain('## Warnings');
// for (const resourceName of resourceNames) {
// expect(readme).toContain(`### ${resourceName}`);
// }
// } finally {
// await fixture.cdkDestroy('migrate-stack');
// await fixture.aws.cloudFormation('deleteGeneratedTemplate', {
// GeneratedTemplateName: stackName,
// });
// }
// }));

['typescript', 'python', 'csharp', 'java'].forEach(language => {
integTest(`cdk migrate --from-stack creates deployable ${language} app`, withExtendedTimeoutFixture(async (fixture) => {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2b60f66

Please sign in to comment.