Topic 1 Question 197
You are planning to add unit tests to your application. You need to be able to assert that published Pub/Sub messages are processed by your subscriber in order. You want the unit tests to be cost-effective and reliable. What should you do?
Implement a mocking framework.
Create a topic and subscription for each tester.
Add a filter by tester to the subscription.
Use the Pub/Sub emulator.
ユーザの投票
コメント(7)
- 正解だと思う選択肢: D
The answer is D. See https://cloud.google.com/pubsub/docs/emulator, "Testing apps locally with the emulator".
👍 2x_cath2022/12/15 - 正解だと思う選択肢: D
Agree with D, use the emulator for testing.
👍 2micoams2022/12/19 - 正解だと思う選択肢: D
Option B, creating a topic and subscription for each tester, would be costly and time-consuming as it would require creating and managing a large number of topics and subscriptions. Additionally, it would not ensure that messages are processed in order, as messages may be delivered out of order to different subscriptions.
Option D, using the Pub/Sub emulator, would be cost-effective and reliable as it allows you to test your application's Pub/Sub functionality locally without incurring any costs. Additionally, the emulator allows you to easily assert that messages are processed in order by using the same topic and subscription for all unit tests.
👍 2omermahgoub2023/01/28
シャッフルモード