@@ -365,17 +365,14 @@ TEST(BucketCache, UpdateInotify1)
365365 sf::path ttp{tp / fmt::format (" {}{}" , fbase, ix)};
366366 sf::remove (ttp);
367367 }
368-
369- /* this step is async, temporally consistent */
370- std::cout << " waiting 1000ms for cache sync" << std::endl;
371- std::this_thread::sleep_for (1000ms);
372368} /* SetupInotify1 */
373369
374370TEST (BucketCache, List2Inotify1)
375371{
376372 std::string bucket{" inotify1" };
377373 std::string marker{" " };
378374 std::vector<std::string> names;
375+ int timeout = 50 ;
379376
380377 auto f = [&](const rgw_bucket_dir_entry& bde) -> int {
381378 // std::cout << fmt::format("called back with {}", bde.key.name) << std::endl;
@@ -384,7 +381,17 @@ TEST(BucketCache, List2Inotify1)
384381 };
385382
386383 MockSalBucket sb{bucket};
387- (void ) bucket_cache->list_bucket (dpp, null_yield, &sb, marker, f);
384+
385+ /* Do a timed backoff up to ~20 seconds to pass on CI */
386+ while (timeout < 16000 ) {
387+ (void )bucket_cache->list_bucket (dpp, null_yield, &sb, marker, f);
388+ if (names.size () == 25 )
389+ break ;
390+ std::cout << fmt::format (" waiting for {}ms for cache sync" , timeout) << std::endl;
391+ std::this_thread::sleep_for (1000ms);
392+ timeout *= 2 ;
393+ names.clear ();
394+ }
388395 ASSERT_EQ (names.size (), 25 );
389396
390397 /* check these */
0 commit comments