diff --git a/v2/robotmk/src/bin/scheduler/internal_config.rs b/v2/robotmk/src/bin/scheduler/internal_config.rs index 563043aa..da35d96f 100644 --- a/v2/robotmk/src/bin/scheduler/internal_config.rs +++ b/v2/robotmk/src/bin/scheduler/internal_config.rs @@ -3,7 +3,7 @@ use crate::results::suite_results_directory; use crate::rf::robot::Robot; use crate::sessions::session::Session; use robotmk::{ - config::{Config, WorkingDirectoryCleanupConfig}, + config::{Config, RCCConfig, WorkingDirectoryCleanupConfig}, lock::Locker, section::Host, }; @@ -16,7 +16,7 @@ use tokio_util::sync::CancellationToken; pub struct GlobalConfig { pub working_directory: Utf8PathBuf, pub results_directory: Utf8PathBuf, - pub rcc_binary_path: Utf8PathBuf, + pub rcc_config: RCCConfig, pub cancellation_token: CancellationToken, pub results_directory_locker: Locker, } @@ -64,7 +64,7 @@ pub fn from_external_config( }, environment: Environment::new( &suite_id, - &external_config.rcc_binary_path, + &external_config.rcc_config.binary_path, &suite_config.environment_config, ), session: Session::new(&suite_config.session_config), @@ -80,7 +80,7 @@ pub fn from_external_config( GlobalConfig { working_directory: external_config.working_directory, results_directory: external_config.results_directory, - rcc_binary_path: external_config.rcc_binary_path, + rcc_config: external_config.rcc_config, cancellation_token, results_directory_locker, }, @@ -155,7 +155,9 @@ mod tests { Config { working_directory: Utf8PathBuf::from("/working"), results_directory: Utf8PathBuf::from("/results"), - rcc_binary_path: Utf8PathBuf::from("/bin/rcc"), + rcc_config: RCCConfig { + binary_path: Utf8PathBuf::from("/bin/rcc"), + }, suites: HashMap::from([ (String::from("system"), system_suite_config()), (String::from("rcc"), rcc_suite_config()), @@ -166,7 +168,12 @@ mod tests { ); assert_eq!(global_config.working_directory, "/working"); assert_eq!(global_config.results_directory, "/results"); - assert_eq!(global_config.rcc_binary_path, "/bin/rcc"); + assert_eq!( + global_config.rcc_config, + RCCConfig { + binary_path: Utf8PathBuf::from("/bin/rcc"), + } + ); assert_eq!(suites.len(), 2); assert_eq!(suites[0].id, "rcc"); assert_eq!(suites[0].working_directory, "/working/suites/rcc"); diff --git a/v2/robotmk/src/bin/scheduler/setup/rcc.rs b/v2/robotmk/src/bin/scheduler/setup/rcc.rs index e22a3e40..c89d9234 100644 --- a/v2/robotmk/src/bin/scheduler/setup/rcc.rs +++ b/v2/robotmk/src/bin/scheduler/setup/rcc.rs @@ -14,7 +14,7 @@ use std::collections::HashMap; use std::fs::{create_dir_all, remove_dir_all}; pub fn setup(global_config: &GlobalConfig, suites: Vec) -> Result> { - adjust_rcc_binary_permissions(&global_config.rcc_binary_path) + adjust_rcc_binary_permissions(&global_config.rcc_config.binary_path) .context("Failed to adjust permissions of RCC binary")?; clear_rcc_setup_working_directory(&rcc_setup_working_directory( &global_config.working_directory, @@ -121,7 +121,7 @@ fn disable_rcc_telemetry( global_config, suites, &CommandSpec { - executable: global_config.rcc_binary_path.to_string(), + executable: global_config.rcc_config.binary_path.to_string(), arguments: vec![ "configure".into(), "identity".into(), @@ -140,7 +140,7 @@ fn enable_long_path_support( global_config, suites, &CommandSpec { - executable: global_config.rcc_binary_path.to_string(), + executable: global_config.rcc_config.binary_path.to_string(), arguments: vec!["configure".into(), "longpaths".into(), "--enable".into()], }, "long_path_support_enabling", @@ -155,7 +155,7 @@ fn shared_holotree_init( global_config, suites, &CommandSpec { - executable: global_config.rcc_binary_path.to_string(), + executable: global_config.rcc_config.binary_path.to_string(), arguments: vec![ "holotree".into(), "shared".into(), @@ -175,7 +175,7 @@ fn holotree_init( global_config, suites, &CommandSpec { - executable: global_config.rcc_binary_path.to_string(), + executable: global_config.rcc_config.binary_path.to_string(), arguments: vec!["holotree".into(), "init".into()], }, "holotree_initialization", diff --git a/v2/robotmk/src/config.rs b/v2/robotmk/src/config.rs index 27e59965..b4c75e5f 100644 --- a/v2/robotmk/src/config.rs +++ b/v2/robotmk/src/config.rs @@ -14,10 +14,15 @@ pub fn load(path: &Utf8Path) -> Result { pub struct Config { pub working_directory: Utf8PathBuf, pub results_directory: Utf8PathBuf, - pub rcc_binary_path: Utf8PathBuf, + pub rcc_config: RCCConfig, pub suites: HashMap, } +#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] +pub struct RCCConfig { + pub binary_path: Utf8PathBuf, +} + #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub struct SuiteConfig { pub robot_framework_config: RobotFrameworkConfig, diff --git a/v2/robotmk/tests/test_scheduler.rs b/v2/robotmk/tests/test_scheduler.rs index b0e1df60..8bcb2317 100644 --- a/v2/robotmk/tests/test_scheduler.rs +++ b/v2/robotmk/tests/test_scheduler.rs @@ -2,7 +2,7 @@ use anyhow::Result; use assert_cmd::cargo::cargo_bin; use camino::{Utf8Path, Utf8PathBuf}; use robotmk::config::{ - Config, EnvironmentConfig, ExecutionConfig, RCCEnvironmentConfig, RetryStrategy, + Config, EnvironmentConfig, ExecutionConfig, RCCConfig, RCCEnvironmentConfig, RetryStrategy, RobotFrameworkConfig, SessionConfig, SuiteConfig, UserSessionConfig, WorkingDirectoryCleanupConfig, }; @@ -34,7 +34,7 @@ async fn test_scheduler() -> Result<()> { assert_working_directory(&config.working_directory, ¤t_user_name).await?; assert_results_directory(&config.results_directory); - assert_rcc(&config.rcc_binary_path).await?; + assert_rcc(&config.rcc_config).await?; Ok(()) } @@ -48,7 +48,9 @@ fn create_config( Config { working_directory: test_dir.join("working"), results_directory: test_dir.join("results"), - rcc_binary_path: rcc_binary_path.into(), + rcc_config: RCCConfig { + binary_path: rcc_binary_path.into(), + }, suites: [ ( String::from("rcc_headless"), @@ -249,10 +251,10 @@ fn assert_results_directory(results_directory: &Utf8Path) { ); } -async fn assert_rcc(rcc_binary_path: impl AsRef) -> Result<()> { - assert_rcc_binary_permissions(&rcc_binary_path).await?; - assert_rcc_configuration(&rcc_binary_path).await?; - assert_rcc_longpath_support_enabled(&rcc_binary_path).await +async fn assert_rcc(rcc_config: &RCCConfig) -> Result<()> { + assert_rcc_binary_permissions(&rcc_config.binary_path).await?; + assert_rcc_configuration(&rcc_config.binary_path).await?; + assert_rcc_longpath_support_enabled(&rcc_config.binary_path).await } async fn assert_rcc_binary_permissions(rcc_binary_path: impl AsRef) -> Result<()> {