Skip to content

Commit

Permalink
feat: plugin executor configurable
Browse files Browse the repository at this point in the history
Signed-off-by: Aisha M <[email protected]>
  • Loading branch information
aamohd committed Jan 6, 2025
1 parent 1f7811a commit f571a46
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion hipcheck/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ impl ExecConfig {
/* jitter_percent */ plugin_data.jitter.percent,
/*grpc_buffer*/ plugin_data.grpc_buffer.size,
)
}
}

impl FromStr for ExecConfig {
Expand Down Expand Up @@ -528,7 +529,7 @@ mod test {
#[test]
fn test_read_exec_config_file() {
let root = workspace_dir();
let path = pathbuf![&root, "config", "Config.kdl"];
let path = pathbuf![&root, "config", "Exec.kdl"];
let config = ExecConfig::from_file(path);
assert!(config.is_ok())
}
Expand Down
22 changes: 7 additions & 15 deletions hipcheck/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,18 +514,6 @@ fn cmd_plugin(args: PluginArgs, config: &CliConfig) -> ExitCode {
.context("Failed to locate the exec config. Please make sure the exec config file exists somewhere in this directory or one of its parents as '.hipcheck/Exec.kdl'.")
};

let exec_config = match res_exec_config {
Ok(config) => {
config
},
Err(e) => {
Shell::print_error(&hc_error!("Failed to resolve the exec config {}", e), Format::Human);
return ExitCode::FAILURE;
}

config
}.unwrap();

let exec_config = match res_exec_config {
Ok(config) => {
config
Expand All @@ -536,9 +524,13 @@ fn cmd_plugin(args: PluginArgs, config: &CliConfig) -> ExitCode {
}
};

let plugin_executor = ExecConfig::get_plugin_executor(&exec_config)
.context("Failed to resolve the Plugin Executor.")
.unwrap();
let plugin_executor = match ExecConfig::get_plugin_executor(&exec_config) {
Ok(e) => e,
Err(e) => {
Shell::print_error(&hc_error!("Failed to resolve the Plugin Executor {}", e), Format::Human);
return ExitCode::FAILURE;
}
};

let engine = match HcEngineImpl::new(
plugin_executor,
Expand Down

0 comments on commit f571a46

Please sign in to comment.