Exam DOP-C02 All QuestionsBrowse all questions from this exam
Question 273

A company uses the AWS Cloud Development Kit (AWS CDK) to define its application. The company uses a pipeline that consists of AWS CodePipeline and AWS CodeBuild to deploy the CDK application.

The company wants to introduce unit tests to the pipeline to test various infrastructure components. The company wants to ensure that a deployment proceeds if no unit tests result in a failure.

Which combination of steps will enforce the testing requirement in the pipeline? (Choose two.)

    Correct Answer: A, D

    To ensure no unit tests result in failure before proceeding with deployment in an AWS CodePipeline and AWS CodeBuild setup for a CDK application, you should take the following steps: (1) Update the CodeBuild build phase commands to run the tests then to deploy the application, setting the OnFailure phase property to ABORT. This ensures that if any tests fail, the pipeline stops and prevents deployment. (2) Create a test using the AWS CDK assertions module with the template.hasResourceProperties assertion. This verifies that the resources have the expected properties, ensuring the infrastructure components are correct before deployment.

Discussion
trungtdOptions: AD

I'm not sure but A D seems right

TEC1Options: AD

A. This step is crucial because: It integrates the unit tests into the build phase of CodeBuild. By setting the OnFailure property to ABORT, it ensures that the pipeline stops if any tests fail, preventing deployment of potentially faulty infrastructure. If all tests pass, the deployment will proceed as normal. D. This step is important because: It utilizes the AWS CDK assertions module, which is specifically designed for testing CDK applications. The template.hasResourceProperties assertion allows you to verify that the resources defined in your CDK code have the expected properties. This type of test can catch issues in your infrastructure definition before deployment.