Skip to content

Commit 3f9e2e9

Browse files
committed
Problems with tests here
1 parent c919110 commit 3f9e2e9

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

packages/@aws-cdk-testing/framework-integ/test/core/test/tree-metadata.test.ts

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as path from 'path';
66
import { Construct } from 'constructs';
77
import * as cxschema from 'aws-cdk-lib/cloud-assembly-schema';
88
import type { TreeInspector } from 'aws-cdk-lib';
9-
import { App, AssumptionError, CfnParameter, CfnResource, Lazy, Stack, aws_s3 } from 'aws-cdk-lib';
9+
import { App, AssumptionError, CfnParameter, CfnResource, Lazy, Stack, Validations, aws_s3 } from 'aws-cdk-lib';
1010
import { lit } from 'aws-cdk-lib/core/lib/helpers-internal';
1111
import type { ForestFile, TreeFile } from 'aws-cdk-lib/core/lib/helpers-internal';
1212

@@ -25,10 +25,21 @@ abstract class AbstractCfnResource extends CfnResource {
2525
protected abstract override get cfnProperties(): { [key: string]: any };
2626
}
2727

28+
let app: App;
29+
beforeEach(() => {
30+
app = new App();
31+
acknowledgeProblems();
32+
});
33+
34+
function acknowledgeProblems() {
35+
Validations.of(app).acknowledge(
36+
{ id: 'CloudFormation-Validate::F3006', reason: 'We are using fake resource types here' },
37+
{ id: 'CloudFormation-Validate::F0001', reason: 'Empty resource sections' },
38+
);
39+
}
40+
2841
describe('tree metadata', () => {
2942
test('tree metadata is generated as expected', () => {
30-
const app = new App();
31-
3243
const stack = new Stack(app, 'mystack');
3344
new Construct(stack, 'myconstruct');
3445

@@ -78,8 +89,6 @@ describe('tree metadata', () => {
7889
});
7990

8091
test('L1 resource add logicalID to tree metadata', () => {
81-
const app = new App();
82-
8392
const stack = new Stack(app, 'mystack');
8493
new aws_s3.Bucket(stack, 'Bucky');
8594

@@ -130,7 +139,6 @@ describe('tree metadata', () => {
130139
}
131140
}
132141

133-
const app = new App();
134142
const stack = new Stack(app, 'mystack');
135143
new MyCfnResource(stack, 'mycfnresource');
136144

@@ -195,8 +203,6 @@ describe('tree metadata', () => {
195203
// class names are found. If this test is NOT running on CodeBuild, we will
196204
// allow the specific class name (for a 'jsii' build) or the generic
197205
// 'constructs.Construct' class name (for a 'tsc' build).
198-
const app = new App();
199-
200206
const stack = new Stack(app, 'mystack');
201207
new CfnResource(stack, 'myconstruct', { type: 'Aws::Some::Resource' });
202208

@@ -237,12 +243,13 @@ describe('tree metadata', () => {
237243
*/
238244
test('tree.json can be split over multiple files', () => {
239245
const MAX_NODES = 1_000;
240-
const app = new App({
246+
app = new App({
241247
context: {
242248
'@aws-cdk/core.TreeMetadata:maxNodes': MAX_NODES,
243249
},
244250
analyticsReporting: false,
245251
});
252+
acknowledgeProblems();
246253

247254
// GIVEN
248255
const buildStart = Date.now();
@@ -343,7 +350,6 @@ describe('tree metadata', () => {
343350
});
344351

345352
test('token resolution & cfn parameter', () => {
346-
const app = new App();
347353
const stack = new Stack(app, 'mystack');
348354
const cfnparam = new CfnParameter(stack, 'mycfnparam');
349355

@@ -429,7 +435,6 @@ describe('tree metadata', () => {
429435
}
430436
}
431437

432-
const app = new App();
433438
const firststack = new Stack(app, 'myfirststack');
434439
const firstres = new MyFirstResource(firststack, 'myfirstresource');
435440
const secondstack = new Stack(app, 'mysecondstack');
@@ -488,9 +493,10 @@ describe('tree metadata', () => {
488493

489494
test('tree metadata can be disabled', () => {
490495
// GIVEN
491-
const app = new App({
496+
app = new App({
492497
treeMetadata: false,
493498
});
499+
acknowledgeProblems();
494500

495501
// WHEN
496502
const stack = new Stack(app, 'mystack');
@@ -510,7 +516,6 @@ describe('tree metadata', () => {
510516
}
511517
}
512518

513-
const app = new App();
514519
const stack = new Stack(app, 'mystack');
515520
new MyCfnResource(stack, 'mycfnresource', {
516521
type: 'CDK::UnitTest::MyCfnResource',

0 commit comments

Comments
 (0)