forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codepipeline): manual approval action doesn't have configuration …
…without a topic We were only rendering the CustomData and ExternalEntityLink configuration properties for the manual approval action if a notification SNS topic was either created or passed when instantiating the action. This is a mistake, as those properties make sense even when the action doesn't publish anything to a topic. Fixes aws#6100
- Loading branch information
Showing
3 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
packages/@aws-cdk/aws-codepipeline-actions/test/test.manual-approval.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { expect, haveResourceLike} from '@aws-cdk/assert'; | ||
import * as codepipeline from '@aws-cdk/aws-codepipeline'; | ||
import * as sns from '@aws-cdk/aws-sns'; | ||
import { SecretValue, Stack } from '@aws-cdk/core'; | ||
import { Test } from 'nodeunit'; | ||
import * as cpactions from '../lib'; | ||
|
||
// tslint:disable:object-literal-key-quotes | ||
|
||
export = { | ||
'manual approval Action': { | ||
'allows passing an SNS Topic when constructing it'(test: Test) { | ||
const stack = new Stack(); | ||
const topic = new sns.Topic(stack, 'Topic'); | ||
const manualApprovalAction = new cpactions.ManualApprovalAction({ | ||
actionName: 'Approve', | ||
notificationTopic: topic, | ||
}); | ||
const pipeline = new codepipeline.Pipeline(stack, 'pipeline'); | ||
const stage = pipeline.addStage({ stageName: 'stage' }); | ||
stage.addAction(manualApprovalAction); | ||
|
||
test.equal(manualApprovalAction.notificationTopic, topic); | ||
|
||
test.done(); | ||
}, | ||
|
||
'renders CustomData and ExternalEntityLink even if notificationTopic was not passed'(test: Test) { | ||
const stack = new Stack(); | ||
new codepipeline.Pipeline(stack, 'pipeline', { | ||
stages: [ | ||
{ | ||
stageName: 'Source', | ||
actions: [new cpactions.GitHubSourceAction({ | ||
actionName: 'Source', | ||
output: new codepipeline.Artifact(), | ||
oauthToken: SecretValue.plainText('secret'), | ||
owner: 'aws', | ||
repo: 'aws-cdk', | ||
})], | ||
}, | ||
{ | ||
stageName: 'Approve', | ||
actions: [ | ||
new cpactions.ManualApprovalAction({ | ||
actionName: 'Approval', | ||
additionalInformation: 'extra info', | ||
externalEntityLink: 'external link', | ||
}), | ||
], | ||
}, | ||
], | ||
}); | ||
|
||
expect(stack).to(haveResourceLike('AWS::CodePipeline::Pipeline', { | ||
"Stages": [ | ||
{ | ||
"Name": "Source", | ||
}, | ||
{ | ||
"Name": "Approve", | ||
"Actions": [ | ||
{ | ||
"Name": "Approval", | ||
"Configuration": { | ||
"CustomData": "extra info", | ||
"ExternalEntityLink": "external link", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
})); | ||
|
||
test.done(); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters