Fix some test config options
This commit is contained in:
parent
f183dd23c2
commit
76766ace7a
3 changed files with 21 additions and 9 deletions
|
@ -4,8 +4,21 @@
|
|||
macro_rules! setup_test_config {
|
||||
() => {
|
||||
#[cfg(test)]
|
||||
config::init_config(Path::new(
|
||||
&env::var("CK_TEST_CONFIG").expect("CK_TEST_CONFIG environment variable not set"),
|
||||
)).expect("Could not initialize test config");
|
||||
{
|
||||
let path = std::env::var("CK_TEST_CONFIG")
|
||||
.expect("CK_TEST_CONFIG environment variable not set");
|
||||
let path = std::path::Path::new(&path);
|
||||
|
||||
config::init_config(&path).expect("Could not initialize test config");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::module_inception)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn can_parse_test_config() {
|
||||
setup_test_config!();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
use axum::Router;
|
||||
|
||||
use tokio::runtime;
|
||||
|
||||
use config::get_config;
|
||||
|
||||
pub mod api {
|
||||
|
@ -39,8 +38,8 @@ pub fn init() -> anyhow::Result<()> {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
macros::test_setup_config!();
|
||||
}
|
||||
// #[test]
|
||||
// fn test() {
|
||||
// macros::setup_test_config!();
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
"build": "cargo build --profile ${NODE_ENV:=development}",
|
||||
"revertmigration": "typeorm migration:revert -d ormconfig.js",
|
||||
"lint": "cargo check",
|
||||
"test": "CK_TEST_CONFIG='../../.config/test.yml' cargo test --workspace"
|
||||
"test": "CK_TEST_CONFIG=\"$(pwd)/../../.config/ci.yml\" cargo test --workspace"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue