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?
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.
The best answer is 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.
Here's why:
Pub/Sub Emulator: The Pub/Sub emulator provides a local environment that mimics the behavior of the production Pub/Sub service. This allows you to test your application's Pub/Sub integration without needing to deploy to Google Cloud.
Testing with Random Data: Generating random content in the publishing service ensures that your application can handle various data formats and scenarios. This helps identify potential issues that might not be caught by unit testing alone.
Controlled Environment: Using the emulator gives you a controlled environment where you can easily manipulate the messages being published, allowing you to test different scenarios and edge cases.
Let's analyze why the other options are less suitable:
B. Collect messages from production and replay: This approach is risky because it involves using real production data, which might contain sensitive information. It also doesn't provide a controlled environment for testing.
C. Collect messages from production and publish to the emulator: This approach still involves using real production data, which can be problematic. It also doesn't allow for testing with random data or controlled scenarios.
D. Publish a standard set of testing messages: While using a standard set of messages is helpful, it might not cover all possible scenarios. Generating random content provides a more comprehensive test.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
scaenruy
Highly Voted 2 years, 10 months agothewalker
Most Recent 4 months, 1 week agothewalker
4 months, 1 week agowanrltw
1 year agoamier
1 year, 4 months agozellck
1 year, 11 months agolakiluk
2 years, 1 month agotomato123
2 years, 3 months ago