mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-29 12:47:02 +00:00
The REST test test_storage_service.py::test_toppartitions_pk_needs_escaping was flaky. It tests the toppartition request, which unfortunately needs to choose a sampling duration in advance, and we chose 1 second which we considered more than enough - and indeed typically even 1ms is enough! but very rarely (only know of only one occurance, in issue #13223) one second is not enough. Instead of increasing this 1 second and making this test even slower, this patch takes a retry approach: The tests starts with a 0.01 second duration, and is then retried with increasing durations until it succeeds or a 5-seconds duration is reached. This retry approach has two benefits: 1. It de-flakes the test (allowing a very slow test to take 5 seconds instead of 1 seconds which wasn't enough), and 2. At the same time it makes a successful test much faster (it used to always take a full second, now it takes 0.07 seconds on a dev build on my laptop). A *failed* test may, in some cases, take 10 seconds after this patch (although in some other cases, an error will be caught immediately), but I consider this acceptable - this test should pass, after all, and a failure indicates a regression and taking 10 seconds will be the last of our worries in that case. Fixes #13223. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #13238