fix: fix some issues
This commit is contained in:
9
apps/recorder/src/test_utils/crypto.rs
Normal file
9
apps/recorder/src/test_utils/crypto.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
use crate::{
|
||||
crypto::{CryptoConfig, CryptoService},
|
||||
errors::RecorderResult,
|
||||
};
|
||||
|
||||
pub async fn build_testing_crypto_service() -> RecorderResult<CryptoService> {
|
||||
let crypto = CryptoService::from_config(CryptoConfig {}).await?;
|
||||
Ok(crypto)
|
||||
}
|
||||
@@ -5,7 +5,7 @@ use crate::{
|
||||
|
||||
#[cfg(feature = "testcontainers")]
|
||||
pub async fn build_testing_database_service() -> RecorderResult<DatabaseService> {
|
||||
use testcontainers::runners::AsyncRunner;
|
||||
use testcontainers::{ImageExt, runners::AsyncRunner};
|
||||
use testcontainers_ext::{ImageDefaultLogConsumerExt, ImagePruneExistedLabelExt};
|
||||
use testcontainers_modules::postgres::Postgres;
|
||||
|
||||
@@ -13,6 +13,7 @@ pub async fn build_testing_database_service() -> RecorderResult<DatabaseService>
|
||||
.with_db_name("konobangu")
|
||||
.with_user("konobangu")
|
||||
.with_password("konobangu")
|
||||
.with_tag("17-alpine")
|
||||
.with_default_log_consumer()
|
||||
.with_prune_existed_label(env!("CARGO_PKG_NAME"), "postgres", true, true)
|
||||
.await?;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod app;
|
||||
pub mod crypto;
|
||||
pub mod database;
|
||||
pub mod mikan;
|
||||
pub mod storage;
|
||||
|
||||
@@ -5,6 +5,7 @@ pub fn try_init_testing_tracing(level: Level) {
|
||||
let crate_name = env!("CARGO_PKG_NAME");
|
||||
let level = level.as_str().to_lowercase();
|
||||
let filter = EnvFilter::new(format!("{crate_name}[]={level}"))
|
||||
.add_directive(format!("mockito[]={level}").parse().unwrap());
|
||||
.add_directive(format!("mockito[]={level}").parse().unwrap())
|
||||
.add_directive(format!("sqlx[]={level}").parse().unwrap());
|
||||
let _ = tracing_subscriber::fmt().with_env_filter(filter).try_init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user