DOP-C02 Question 35
Select 3You are a DevOps engineer designing a CI/CD pipeline for a company that develops a web application. The team wants to ensure that application code is thoroughly tested while keeping the pipeline efficient. Which of the following is the most appropriate use of tests at different stages of the CI/CD pipeline?
- A
Run unit tests during the build phase to validate individual components of the application.
- B
Execute integration tests during the build phase to identify issues between system components early.
- C
Perform smoke tests during the deployment phase to ensure the basic functionality of the application.
- D
Run load tests during the source code commit phase to validate performance under high user traffic.
- E
Conduct end-to-end tests as part of the staging environment to validate user workflows before production release.
Show answer and explanation
Correct answers: A, C, E
Explanation
Different types of tests serve specific purposes and are best suited for specific stages of the CI/CD pipeline. Unit tests are lightweight and fast, making them ideal for the early build phase. Smoke tests ensure the basic functionality of the application after deployment and are suitable for the deployment phase. End-to-end tests, while resource-intensive, are critical for validating user workflows and are best executed in the staging environment before a production release. Understanding the reasonable use of tests ensures an efficient and reliable CI/CD pipeline.
- A. Correct.
Running unit tests during the build phase is a best practice as they are fast and help catch issues in individual components early in the pipeline.
- B. Incorrect.
While integration tests are important, running them during the build phase can significantly slow down the pipeline. Integration tests are better suited for later stages.
- C. Correct.
Smoke tests are lightweight and ensure that the core application functionality works after deployment. This is a reasonable use of smoke tests.
- D. Incorrect.
Load tests are resource-intensive and not suitable for the source code commit phase. They are typically performed in staging or a dedicated performance testing environment.
- E. Correct.
End-to-end tests are slow and resource-intensive but critical for validating user workflows. Staging is an appropriate place to conduct these tests before production to ensure user-facing functionality is correct.