Skip to content

Commit

Permalink
cloud_storage_clients: fix test race conditions causing failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nvartolomei committed Dec 19, 2023
1 parent e16fe06 commit a6111c0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/v/cloud_storage_clients/tests/client_pool_mt_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,29 @@ SEASTAR_THREAD_TEST_CASE(test_client_pool_acquire_blocked_on_another_shard) {
});
});

ss::sleep(1ms).get();
// Wait for the above future to get scheduled and block.
pool
.invoke_on_others([](cloud_storage_clients::client_pool& pool) {
while (!pool.has_waiters()) {
return ss::yield();
}
return ss::now();
})
.get();

vlog(test_log.debug, "return lease to the current shard");
leases.pop_front();
ss::sleep(1ms).get();

pool
.invoke_on_all([](cloud_storage_clients::client_pool& pool) {
while (pool.has_background_operations()) {
return ss::yield();
}
return ss::now();
})
.get();
;

// Since we returned to the current shard the future that
// await for the 'acquire' method to be completed on another shard
// souldn't become available.
Expand Down

0 comments on commit a6111c0

Please sign in to comment.