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 {
|
macro_rules! setup_test_config {
|
||||||
() => {
|
() => {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
config::init_config(Path::new(
|
{
|
||||||
&env::var("CK_TEST_CONFIG").expect("CK_TEST_CONFIG environment variable not set"),
|
let path = std::env::var("CK_TEST_CONFIG")
|
||||||
)).expect("Could not initialize 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 axum::Router;
|
||||||
|
|
||||||
use tokio::runtime;
|
use tokio::runtime;
|
||||||
|
|
||||||
use config::get_config;
|
use config::get_config;
|
||||||
|
|
||||||
pub mod api {
|
pub mod api {
|
||||||
|
@ -39,8 +38,8 @@ pub fn init() -> anyhow::Result<()> {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn test() {
|
// fn test() {
|
||||||
macros::test_setup_config!();
|
// macros::setup_test_config!();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,6 @@
|
||||||
"build": "cargo build --profile ${NODE_ENV:=development}",
|
"build": "cargo build --profile ${NODE_ENV:=development}",
|
||||||
"revertmigration": "typeorm migration:revert -d ormconfig.js",
|
"revertmigration": "typeorm migration:revert -d ormconfig.js",
|
||||||
"lint": "cargo check",
|
"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