feat: allow health check forcing in debug, setup test mocking, plan out integration tests

This commit is contained in:
Ryan Walters
2025-09-18 22:42:00 -05:00
parent 350f92ab21
commit e2c725cb95
8 changed files with 292 additions and 82 deletions

View File

@@ -4,16 +4,18 @@ use pacman_server::{
auth::AuthRegistry,
config::Config,
};
use std::sync::Arc;
use testcontainers::{
core::{IntoContainerPort, WaitFor},
runners::AsyncRunner,
ContainerAsync, GenericImage, ImageExt,
};
use tokio::sync::Notify;
/// Test configuration for integration tests
pub struct TestConfig {
pub database_url: String,
pub _container: ContainerAsync<GenericImage>,
pub container: ContainerAsync<GenericImage>,
pub config: Config,
}
@@ -45,7 +47,7 @@ impl TestConfig {
Self {
database_url,
_container: container,
container,
config,
}
}
@@ -87,7 +89,8 @@ pub async fn create_test_app_state(test_config: &TestConfig) -> AppState {
let auth = AuthRegistry::new(&test_config.config).expect("Failed to create auth registry");
// Create app state
let app_state = AppState::new(test_config.config.clone(), auth, db);
let notify = Arc::new(Notify::new());
let app_state = AppState::new(test_config.config.clone(), auth, db, notify).await;
// Set health status to true for tests (migrations and database are both working)
{