Files
hotel-service/src/test.rs
2024-12-17 17:05:43 +00:00

16 lines
577 B
Rust

use crate::config;
use diesel_async::AsyncPgConnection;
use lib::test::test_containers::{ContainerError, TestContainer};
pub(crate) async fn create_test_containers_pool<'a>() -> Result<TestContainer, ContainerError> {
let test_container = lib::test::test_containers::create_test_containers_pool().await?;
run_migrations(test_container.pool.get().await?.as_mut()).await?;
Ok(test_container)
}
pub(crate) async fn run_migrations(
conn: &mut AsyncPgConnection,
) -> Result<(), diesel::result::Error> {
config::MIGRATIONS.run_pending_migrations(conn).await
}