add program argument for functional testing; simplify execute argument
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
ffc41cb01f
commit
fcb9d04d9e
2 changed files with 12 additions and 4 deletions
|
@ -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<String>,
|
||||
|
||||
#[serde(flatten)]
|
||||
#[allow(clippy::zero_sized_map_values)] // this is a catchall, the map shouldn't be zero at runtime
|
||||
catchall: BTreeMap<String, IgnoredAny>,
|
||||
|
|
|
@ -28,6 +28,10 @@ pub(crate) struct Args {
|
|||
/// Execute console command automatically after startup.
|
||||
#[arg(long)]
|
||||
pub(crate) execute: Vec<String>,
|
||||
|
||||
/// Set functional testing modes if available. Ex '--test=smoke'
|
||||
#[arg(long, hide(true))]
|
||||
pub(crate) test: Vec<String>,
|
||||
}
|
||||
|
||||
/// Parse commandline arguments into structured data
|
||||
|
@ -44,9 +48,10 @@ pub(crate) fn update(mut config: Figment, args: &Args) -> Result<Figment> {
|
|||
}
|
||||
|
||||
// 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.
|
||||
|
|
Loading…
Add table
Reference in a new issue