Added the scaffolding for the jitter test. Now just need to perform the proper calculations.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-08-17 18:39:53 -04:00
parent 7555a2a3a7
commit 88be1ad2ba
2 changed files with 45 additions and 8 deletions

View File

@ -25,6 +25,28 @@ pub fn ping_host(address: &str, count: &u16) {
}
}
// network jitter test
pub fn jitter_test(address: &str, count: &u16) {
println!("Pinging host {}, {} times to determine network jitter.", address, count);
// run the ping command
let output = process::Command::new("ping")
.arg(address)
.arg(format!("-c {}", count))
.output()
.expect("Failed to execute command");
// check that the command succeeded
assert!(output.status.success());
// grab the ping results from stdout
let results_raw = &String::from_utf8_lossy(&output.stdout);
let results = text::format::trim_output(results_raw, 4);
for line in results {
println!("{}", line);
}
}
// timed file copy test to guage bandwidth speeds
pub fn bandwidth_test(download: &str, output: &str) {
println!("Testing network bandwidth by downloading {}.", download);