Add stress testing for quota-lock and refactor test guard usage

This commit is contained in:
David Osipov
2026-03-21 15:54:14 +04:00
parent c8632de5b6
commit c1ee43fbac
6 changed files with 60 additions and 47 deletions

View File

@@ -316,6 +316,13 @@ fn quota_user_lock_test_guard() -> &'static Mutex<()> {
TEST_LOCK.get_or_init(|| Mutex::new(()))
}
#[cfg(test)]
fn quota_user_lock_test_scope() -> std::sync::MutexGuard<'static, ()> {
quota_user_lock_test_guard()
.lock()
.unwrap_or_else(|poisoned| poisoned.into_inner())
}
fn quota_overflow_user_lock(user: &str) -> Arc<Mutex<()>> {
let stripes = QUOTA_USER_OVERFLOW_LOCKS.get_or_init(|| {
(0..QUOTA_OVERFLOW_LOCK_STRIPES)