Fix some test config options

This commit is contained in:
s1idewhist1e 2023-05-16 13:30:39 -07:00
parent f183dd23c2
commit 76766ace7a
No known key found for this signature in database
GPG key ID: 9CC756BB9B325062
3 changed files with 21 additions and 9 deletions

View file

@ -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!();
}
}

View file

@ -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!();
// }
}

View file

@ -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"
}
}