Skip to content

Commit

Permalink
fix(cdk-integ-assert-v2): revert the changes for special CDK v2 handl…
Browse files Browse the repository at this point in the history
…ing (#417)

* fix(cdk-integ-assert-v2): revert the changes for special CDK v2 handling

* fix(cdk-integ-assert-v2): Bumping baseline aws-cdk-lib to v2.0.0-rc.23
  • Loading branch information
hnishar committed Oct 4, 2021
1 parent 9c42458 commit 51b1758
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
2 changes: 1 addition & 1 deletion deployment/v2/align-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const findVersion = process.argv[2];
const replaceVersion = process.argv[3];

// these versions need to be sourced from a config file
const awsCdkLibVersion = '2.0.0-rc.16';
const awsCdkLibVersion = '2.0.0-rc.23';
const constructsVersion = '10.0.0';
const MODULE_EXEMPTIONS = new Set([
'@aws-cdk/cloudformation-diff',
Expand Down
43 changes: 3 additions & 40 deletions source/tools/cdk-integ-tools/bin/cdk-integ-assert-v2.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
// Verify that all integration tests still match their expected output
import { canonicalizeTemplate } from '@aws-cdk/assert';
import { diffTemplate, formatDifferences, TemplateDiff } from '@aws-cdk/cloudformation-diff';
import { diffTemplate, formatDifferences } from '@aws-cdk/cloudformation-diff';
import { DEFAULT_SYNTH_OPTIONS, IntegrationTests } from '../lib/integ-helpers';

/* eslint-disable no-console */
Expand Down Expand Up @@ -29,47 +29,10 @@ async function main() {

const diff = diffTemplate(expected, actual);

const v2diff = new TemplateDiff({
awsTemplateFormatVersion: diff.awsTemplateFormatVersion,
outputs: diff.outputs,
description: diff.description,
transform: diff.transform,
conditions: diff.conditions,
mappings: diff.mappings,
metadata: diff.metadata,
resources: diff.resources.filter(d => {
if ((d?.isDifferent) && (d?.resourceType === 'AWS::Lambda::Function') && d?.oldProperties?.Code?.S3Bucket?.Ref.startsWith("AssetParameters")) {
return false;
} else
return true;
}),
parameters: diff.parameters.filter(d => {
if ((d?.isAddition) && (d?.newValue?.Default?.startsWith('/cdk-bootstrap/'))) {
return false;
} else if ((d?.isRemoval) &&
(
(d?.oldValue?.Description?.startsWith('S3 bucket for asset')) ||
(d?.oldValue?.Description?.startsWith('S3 key for asset version')) ||
(d?.oldValue?.Description?.startsWith('Artifact hash for asset'))
)) {
return false;
}
else
return true;
}),
unknown: diff.unknown.filter(d => {
if ((d?.isAddition) && (d?.newValue?.CheckBootstrapVersion)) {
return false;
}
else
return true;
}),
});

if (!v2diff.isEmpty) {
if (!diff.isEmpty) {
failures.push(test.name);
process.stdout.write('CHANGED.\n');
formatDifferences(process.stdout, v2diff);
formatDifferences(process.stdout, diff);
} else {
process.stdout.write('OK.\n');
}
Expand Down

0 comments on commit 51b1758

Please sign in to comment.