Test refactor
Some checks failed
Rust Build / Check (pull_request) Successful in 40s
Rust Build / Test Suite (pull_request) Failing after 45s
Rust Build / Rustfmt (pull_request) Successful in 24s
Rust Build / Clippy (pull_request) Successful in 39s
Rust Build / build (pull_request) Successful in 1m5s

This commit is contained in:
2025-05-31 21:35:42 -04:00
parent 4a35802caa
commit 64f731b1aa

View File

@@ -75,7 +75,7 @@ mod tests {
pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> { pub async fn get_pool() -> Result<sqlx::PgPool, sqlx::Error> {
dotenvy::dotenv().ok(); // Load .env file if it exists dotenvy::dotenv().ok(); // Load .env file if it exists
let tm_db_url = std::env::var(icarus_envy::keys::DBURL).expect("DATABASE_URL must be present"); let tm_db_url = icarus_envy::environment::get_db_url().await;
let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap(); let tm_options = sqlx::postgres::PgConnectOptions::from_str(&tm_db_url).unwrap();
sqlx::PgPool::connect_with(tm_options).await sqlx::PgPool::connect_with(tm_options).await
} }
@@ -87,7 +87,7 @@ mod tests {
} }
pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> { pub async fn connect_to_db(db_name: &str) -> Result<sqlx::PgPool, sqlx::Error> {
let db_url = std::env::var(icarus_envy::keys::DBURL).expect("DATABASE_URL must be set for tests"); let db_url = icarus_envy::environment::get_db_url().await;
let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name); let options = sqlx::postgres::PgConnectOptions::from_str(&db_url)?.database(db_name);
sqlx::PgPool::connect_with(options).await sqlx::PgPool::connect_with(options).await
} }