-
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.
Merge pull request #28 from gammarers/feature/add-pipeline-execution-…
…change-state-filter feat: add pipeline execution change state filter
- Loading branch information
Showing
4 changed files
with
209 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
import { App, Stack } from 'aws-cdk-lib'; | ||
import { Template, Match } from 'aws-cdk-lib/assertions'; | ||
import * as events from 'aws-cdk-lib/aws-events'; | ||
import { CodePipelineExecutionState, CodePipelineExecutionStateChangeDetectionEventRule } from '../src'; | ||
|
||
describe('Default Rule Check', () => { | ||
|
||
const app = new App(); | ||
const stack = new Stack(app, 'TestingStack', { | ||
env: { | ||
account: '123456789012', | ||
region: 'us-east-1', | ||
}, | ||
}); | ||
|
||
const rule = new CodePipelineExecutionStateChangeDetectionEventRule(stack, 'CodePipelineExecutionStateChangeDetectionEventRule', { | ||
ruleName: 'codepipeline-state-change-detection-event-rule', | ||
targetStates: [ | ||
CodePipelineExecutionState.FAILED, | ||
CodePipelineExecutionState.CANCELED, | ||
], | ||
}); | ||
|
||
it('Is Rule', async () => { | ||
expect(rule).toBeInstanceOf(events.Rule); | ||
}); | ||
|
||
const template = Template.fromStack(stack); | ||
|
||
it('Should match event rule.', async () => { | ||
template.hasResourceProperties('AWS::Events::Rule', Match.objectEquals({ | ||
Name: 'codepipeline-state-change-detection-event-rule', | ||
State: 'ENABLED', | ||
EventPattern: Match.objectEquals({ | ||
'source': [ | ||
'aws.codepipeline', | ||
], | ||
'detail-type': [ | ||
'CodePipeline Pipeline Execution State Change', | ||
], | ||
'detail': { | ||
state: Match.arrayEquals(['FAILED', 'CANCELED']), | ||
}, | ||
}), | ||
})); | ||
}); | ||
|
||
it('Should match snapshot.', async () => { | ||
expect(template.toJSON()).toMatchSnapshot(); | ||
}); | ||
|
||
}); |