
Answer-first summary for fast verification
Answer: Configure Cloud Build to run the unit tests, using the specific service account as the build agent. If the code passes the tests, Cloud Build deploys the Cloud Function.
The goal is to ensure that deployment to Cloud Functions only occurs after unit tests pass. Option D correctly integrates the testing and deployment process within Cloud Build. By using the specific service account as the build agent, Cloud Build gains the necessary permissions to deploy. The pipeline first runs the unit tests, and only if they succeed does it proceed to deploy the Cloud Function. This automation ensures that deployment is strictly contingent on passing tests. Other options either run tests after deployment (B), rely on manual steps (A, C), or fail to enforce the required order of operations.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can you configure the unit testing process to ensure that code in a Cloud Source Repositories repository cannot be deployed to Cloud Functions (via a specific service account) without first passing all unit tests?
A
Configure Cloud Build to deploy the Cloud Function. If the code passes the tests, a deployment approval is sent to you.
B
Configure Cloud Build to deploy the Cloud Function, using the specific service account as the build agent. Run the unit tests after successful deployment.
C
Configure Cloud Build to run the unit tests. If the code passes the tests, the developer deploys the Cloud Function.
D
Configure Cloud Build to run the unit tests, using the specific service account as the build agent. If the code passes the tests, Cloud Build deploys the Cloud Function.
No comments yet.