
Answer-first summary for fast verification
Answer: Use the Pub/Sub emulator.
To ensure cost-effective and reliable unit tests that assert Pub/Sub message processing order, using the Pub/Sub emulator (Option D) is the best approach. The emulator provides a local environment that mimics the actual Pub/Sub service, allowing accurate testing of message ordering without incurring costs or relying on external services. Mocking frameworks (Option A) can simulate interactions but may not fully replicate Pub/Sub's ordering guarantees. Creating real topics/subscriptions per tester (Option B) or adding filters (Option C) would introduce costs and reliability issues due to dependency on live infrastructure.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
How can you implement cost-effective and reliable unit tests to verify that published Pub/Sub messages are processed by your subscriber in the correct order?
A
Implement a mocking framework.
B
Create a topic and subscription for each tester.
C
Add a filter by tester to the subscription.
D
Use the Pub/Sub emulator.
No comments yet.