chore: add mutex for test concurrent admin sign in

This commit is contained in:
Zack Fu Zi Xiang 2024-07-16 10:09:31 +08:00
parent a8ed5be8d0
commit d47edf2774
No known key found for this signature in database
1 changed files with 3 additions and 1 deletions

View File

@ -12,6 +12,7 @@ lazy_static! {
password: std::env::var("GOTRUE_ADMIN_PASSWORD").unwrap_or("password".to_string()),
}
};
static ref ADMIN_SIGN_IN_MUTEX: tokio::sync::Mutex<()> = tokio::sync::Mutex::new(());
}
#[derive(Clone, Debug)]
@ -32,7 +33,8 @@ pub async fn admin_user_client() -> Client {
web_sys::console::log_1(&msg.into());
}
admin_client
let _guard = ADMIN_SIGN_IN_MUTEX.lock().await;
let _is_new = admin_client
.sign_in_password(&ADMIN_USER.email, &ADMIN_USER.password)
.await
.unwrap();