feat(test_utils): Add custom-headers and custom delay support to rustman (#2636)

This commit is contained in:
Pa1NarK
2023-11-07 23:00:21 +05:30
committed by GitHub
parent bef0a04edc
commit 1effddd0a0
4 changed files with 104 additions and 11 deletions

View File

@ -3,10 +3,10 @@ use std::process::{exit, Command};
use test_utils::newman_runner;
fn main() {
let mut newman_command: Command = newman_runner::command_generate();
let mut runner = newman_runner::generate_newman_command();
// Execute the newman command
let output = newman_command.spawn();
let output = runner.newman_command.spawn();
let mut child = match output {
Ok(child) => child,
Err(err) => {
@ -16,6 +16,30 @@ fn main() {
};
let status = child.wait();
if runner.file_modified_flag {
let git_status = Command::new("git")
.args([
"restore",
format!("{}/event.prerequest.js", runner.collection_path).as_str(),
])
.output();
match git_status {
Ok(output) => {
if output.status.success() {
let stdout_str = String::from_utf8_lossy(&output.stdout);
println!("Git command executed successfully: {stdout_str}");
} else {
let stderr_str = String::from_utf8_lossy(&output.stderr);
eprintln!("Git command failed with error: {stderr_str}");
}
}
Err(e) => {
eprintln!("Error running Git: {e}");
}
}
}
let exit_code = match status {
Ok(exit_status) => {
if exit_status.success() {