Google Cloud Professional Cloud Developer — Question 265
You work on an application that relies on Cloud Spanner as its main datastore. New application features have occasionally caused performance regressions. You want to prevent performance issues by running an automated performance test with Cloud Build for each commit made. If multiple commits are made at the same time, the tests might run concurrently. What should you do?
Answer options
- A. Create a new project with a random name for every build. Load the required data. Delete the project after the test is run.
- B. Create a new Cloud Spanner instance for every build. Load the required data. Delete the Cloud Spanner instance after the test is run.
- C. Create a project with a Cloud Spanner instance and the required data. Adjust the Cloud Build build file to automatically restore the data to its previous state after the test is run.
- D. Start the Cloud Spanner emulator locally. Load the required data. Shut down the emulator after the test is run.
Correct answer: B
Explanation
The correct answer is B because creating a new Cloud Spanner instance for each build ensures that tests do not interfere with each other and allows for a clean environment for each performance test. Options A and C involve project management complexities that do not directly address the need for isolated testing environments, while option D does not leverage the actual Cloud Spanner service, which could lead to inaccurate performance testing results.