QA Fundamentals · Senior · Question 29 of 76
How do you test eventual consistency in a distributed system?
- 1Poll for the expected state within a timeout, not assert at once
- 2Only test eventually consistent parts manually
- 3Add a fixed sleep of ten seconds before every assertion
Show the answer
Correct answer: Poll for the expected state within a timeout, not assert at once
Explanation
Data may take time to propagate. Assertions that retry until a condition holds (with a sensible limit) are stable and fail clearly when consistency never arrives.