diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index b7708760..6acb814a 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -1,5 +1,5 @@ use std::{ - collections::BTreeMap, + collections::{BTreeMap, BTreeSet}, fmt, net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}, path::PathBuf, @@ -361,6 +361,9 @@ pub struct Config { #[serde(default)] pub tokio_console: bool, + #[serde(default)] + pub test: BTreeSet, + #[serde(flatten)] #[allow(clippy::zero_sized_map_values)] // this is a catchall, the map shouldn't be zero at runtime catchall: BTreeMap, diff --git a/src/main/clap.rs b/src/main/clap.rs index 56d614a4..3af0be02 100644 --- a/src/main/clap.rs +++ b/src/main/clap.rs @@ -28,6 +28,10 @@ pub(crate) struct Args { /// Execute console command automatically after startup. #[arg(long)] pub(crate) execute: Vec, + + /// Set functional testing modes if available. Ex '--test=smoke' + #[arg(long, hide(true))] + pub(crate) test: Vec, } /// Parse commandline arguments into structured data @@ -44,9 +48,10 @@ pub(crate) fn update(mut config: Figment, args: &Args) -> Result { } // Execute commands after any commands listed in configuration file - for command in &args.execute { - config = config.adjoin(("admin_execute", [command])); - } + config = config.adjoin(("admin_execute", &args.execute)); + + // Update config with names of any functional-tests + config = config.adjoin(("test", &args.test)); // All other individual overrides can go last in case we have options which // set multiple conf items at once and the user still needs granular overrides.