Test refactor -async related
Some checks failed
Rust Build / Check (pull_request) Successful in 37s
Rust Build / Test Suite (pull_request) Successful in 52s
Rust Build / Rustfmt (pull_request) Failing after 22s
Rust Build / Clippy (pull_request) Successful in 39s
Rust Build / build (pull_request) Successful in 1m2s

This commit is contained in:
2025-05-31 21:48:14 -04:00
parent f016c7903f
commit 853f8925ef

View File

@@ -79,7 +79,7 @@ mod tests {
pub async fn generate_db_name() -> String {
let db_name =
get_database_name().unwrap() + &"_" + &uuid::Uuid::new_v4().to_string()[..LIMIT];
get_database_name().await.unwrap() + &"_" + &uuid::Uuid::new_v4().to_string()[..LIMIT];
db_name
}
@@ -110,11 +110,8 @@ mod tests {
Ok(())
}
pub fn get_database_name() -> Result<String, Box<dyn std::error::Error>> {
let rt = tokio::runtime::Runtime::new().unwrap();
// Block on the async function to get the result
let database_url = rt.block_on(icarus_envy::environment::get_db_url());
pub async fn get_database_name() -> Result<String, Box<dyn std::error::Error>> {
let database_url = icarus_envy::environment::get_db_url().await;
let parsed_url = url::Url::parse(&database_url)?;
if parsed_url.scheme() == "postgres" || parsed_url.scheme() == "postgresql" {