fix(integration-test): ensure integration tests are runned on a separate DB to avoid polution

This commit is contained in:
Edouard Vanbelle
2026-05-31 23:15:40 +02:00
parent 274cf9da11
commit d2dedcbb00
7 changed files with 143 additions and 34 deletions
@@ -596,18 +596,16 @@ impl SubjectGroupRepository for SubjectGroupPgRepository {
#[allow(dead_code)]
mod integration_tests {
use super::*;
use crate::integration_test_support::{ensure_clean_test_db, test_db_url};
use sqlx::postgres::PgPoolOptions;
const DEFAULT_TEST_DB: &str =
"postgres://oxicloud_test:oxicloud_test@localhost:5433/oxicloud_test";
async fn test_pool() -> Arc<PgPool> {
let url = std::env::var("DATABASE_URL").unwrap_or_else(|_| DEFAULT_TEST_DB.to_string());
let pool = PgPoolOptions::new()
.max_connections(2)
.connect(&url)
.connect(&test_db_url())
.await
.expect("connect to test DB — run tests/common/spawn-db.sh first");
ensure_clean_test_db(&pool).await;
Arc::new(pool)
}