Production Cloud Run service reads from Pub/Sub topic A, processes messages, and writes to topic B. After an error spike, you want to run tests with mock messages to diagnose the issue. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Run Pub/Sub and Cloud Run emulators locally, deploy the service locally, set logging to DEBUG/INFO, publish mock messages to topic A, and analyze logs..
Why this is the answer
Running Pub/Sub and Cloud Run emulators locally allows you to recreate the production environment on your machine without affecting live services. Deploying the service locally ensures you're testing the exact code that runs in production. Publishing mock messages to the local Pub/Sub emulator simulates the input, and setting logging to DEBUG/INFO provides detailed insights into the service's behavior during processing, helping diagnose the error spike. Using gcloud or Cloud Console to publish messages to production topic A is incorrect because it would send mock messages to the live production service, potentially causing further issues or polluting production data. Running only the Pub/Sub emulator locally and pointing the production service to it is also incorrect as it would require network configuration to connect a production service to a local emulator, which is complex and still impacts the production service by changing its message source.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed