Skip to content

Commit 38f11f2

Browse files
authored
Merge pull request ceph#53508 from dang/wip-dang-posix-cache
RGW - Add wait backoff to posix bucket cache test Reviewed-by Matt Benjamin <[email protected]>
2 parents 9b46b9b + c7d2c74 commit 38f11f2

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/test/rgw/test_posix_bucket_cache.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

374370
TEST(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

Comments
 (0)