Google Cloud Professional Cloud Developer — Question 100
You are developing an application that reads credit card data from a Pub/Sub subscription. You have written code and completed unit testing. You need to test the
Pub/Sub integration before deploying to Google Cloud. What should you do?
Answer options
- A. Create a service to publish messages, and deploy the Pub/Sub emulator. Generate random content in the publishing service, and publish to the emulator.
- B. Create a service to publish messages to your application. Collect the messages from Pub/Sub in production, and replay them through the publishing service.
- C. Create a service to publish messages, and deploy the Pub/Sub emulator. Collect the messages from Pub/Sub in production, and publish them to the emulator.
- D. Create a service to publish messages, and deploy the Pub/Sub emulator. Publish a standard set of testing messages from the publishing service to the emulator.
Correct answer: D
Explanation
The correct answer is D because it allows for controlled testing by using a standard set of messages, ensuring that the integration works as intended with the emulator. Options A and C lack the focus on predefined messages, which are crucial for consistent testing, while option B involves production messages that could lead to unintended consequences in a live environment.