From 9957251cb445509c7b4154c3cea66b4c5118d4cf Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Mon, 6 Apr 2020 15:54:47 +0300 Subject: [PATCH] fix codepipelines test --- .../aws-codepipeline/test/test.action.ts | 3 ++- .../aws-codepipeline/test/test.artifacts.ts | 16 ++++++++++------ .../aws-codepipeline/test/test.pipeline.ts | 4 +++- .../aws-codepipeline/test/test.variables.ts | 3 ++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts index 62959c2ca8519..1a8396ed3247f 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.action.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.action.ts @@ -176,7 +176,8 @@ export = { }, 'automatically assigns artifact names to the Actions'(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const pipeline = new codepipeline.Pipeline(stack, 'pipeline'); const sourceOutput = new codepipeline.Artifact(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts b/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts index 4003e0bc41c43..09d6ed0188a35 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.artifacts.ts @@ -16,7 +16,8 @@ export = { }, 'without a name, when used as an input without being used as an output first - should fail validation'(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const sourceOutput = new codepipeline.Artifact(); const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { stages: [ @@ -88,7 +89,8 @@ export = { }, 'without a name, when used as an output multiple times - should fail validation'(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const sourceOutput = new codepipeline.Artifact(); const pipeline = new codepipeline.Pipeline(stack, 'Pipeline', { stages: [ @@ -125,7 +127,8 @@ export = { }, "an Action's output can be used as input for an Action in the same Stage with a higher runOrder"(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const sourceOutput1 = new codepipeline.Artifact('sourceOutput1'); const buildOutput1 = new codepipeline.Artifact('buildOutput1'); @@ -174,7 +177,8 @@ export = { }, 'without a name, sanitize the auto stage-action derived name'(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const sourceOutput = new codepipeline.Artifact(); new codepipeline.Pipeline(stack, 'Pipeline', { @@ -233,6 +237,6 @@ export = { }; function validate(construct: cdk.IConstruct): cdk.ValidationError[] { - cdk.ConstructNode.prepare(construct.node); - return cdk.ConstructNode.validate(construct.node); + cdk.ConstructNode.prepare(construct.node.root.node); + return cdk.ConstructNode.validate(construct.node.root.node); } diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts index 1272ccc9d8fc2..0bdef111c7874 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.pipeline.ts @@ -244,7 +244,9 @@ export = { const replicationRegion = 'us-west-1'; const pipelineRegion = 'us-west-2'; - const pipelineStack = new cdk.Stack(undefined, undefined, { + + const app = new cdk.App(); + const pipelineStack = new cdk.Stack(app, 'stack', { env: { region: pipelineRegion }, }); const sourceOutput = new codepipeline.Artifact(); diff --git a/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts b/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts index 8c01171187c6d..ac37e47d22872 100644 --- a/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts +++ b/packages/@aws-cdk/aws-codepipeline/test/test.variables.ts @@ -42,7 +42,8 @@ export = { }, 'allows using the variable in the configuration of a different action'(test: Test) { - const stack = new cdk.Stack(); + const app = new cdk.App(); + const stack = new cdk.Stack(app, 'stack'); const sourceOutput = new codepipeline.Artifact(); const fakeSourceAction = new FakeSourceAction({ actionName: 'Source',