Google Cloud Professional Cloud Developer — Question 165

Your team is developing unit tests for Cloud Function code. The code is stored in a Cloud Source Repositories repository. You are responsible for implementing the tests. Only a specific service account has the necessary permissions to deploy the code to Cloud Functions. You want to ensure that the code cannot be deployed without first passing the tests. How should you configure the unit testing process?

Answer options

Correct answer: D

Explanation

Option D is correct because it ensures that the unit tests are run under the specific service account, and only if they pass will the deployment occur, thus enforcing the testing requirement before deployment. Option A sends an approval after deployment, which does not prevent code from being deployed without passing tests. Option B runs tests after deployment, which does not ensure compliance before deployment. Option C allows the developer to deploy without any enforcement of the tests being run in the Cloud Build pipeline.