DOP-C02 · Question #440
A company uses AWS CDK and CodePipeline with CodeBuild to deploy applications. The company wants to enforce unit tests before deployment; deployment proceeds only if tests pass. Which steps enforce th
The correct answer is A. Update CodeBuild build commands to run tests then deploy, set OnFailure to ABORT. D. Create tests with AWS CDK assertions module, using template.hasResourceProperties. Running unit tests in the build phase and aborting on failure (OnFailure=ABORT) prevents deployment if tests fail. AWS CDK assertions module provides programmatic unit tests against synthesized templates The --rollback flag relates to CloudFormation stack rollback, not test gatin
Question
A company uses AWS CDK and CodePipeline with CodeBuild to deploy applications. The company wants to enforce unit tests before deployment; deployment proceeds only if tests pass. Which steps enforce this? (Select TWO.)
Options
- AUpdate CodeBuild build commands to run tests then deploy, set OnFailure to ABORT.
- BUpdate CodeBuild commands to run tests then deploy, add --rollback true to cdk deploy.
- CUpdate CodeBuild commands to run tests then deploy, add --require-approval any-change flag.
- DCreate tests with AWS CDK assertions module, using template.hasResourceProperties
- ECreate tests that use cdk diff and fail if any resource changes are detected.
How the community answered
(63 responses)- A84% (53)
- B2% (1)
- C5% (3)
- E10% (6)
Explanation
Running unit tests in the build phase and aborting on failure (OnFailure=ABORT) prevents deployment if tests fail. AWS CDK assertions module provides programmatic unit tests against synthesized templates The --rollback flag relates to CloudFormation stack rollback, not test gating. The --require-approval flag controls manual approvals, not test outcomes. cdk diff checks for changes but is not a unit test and may not catch logical errors.
Topics
Community Discussion
No community discussion yet for this question.