2019-05-16 08:24:23 +00:00
|
|
|
use failure::*;
|
|
|
|
|
|
|
|
use proxmox_backup::client::*;
|
|
|
|
|
2019-08-29 07:58:20 +00:00
|
|
|
async fn upload_speed() -> Result<usize, Error> {
|
2019-05-16 08:24:23 +00:00
|
|
|
|
|
|
|
let host = "localhost";
|
|
|
|
let datastore = "store2";
|
|
|
|
|
|
|
|
let username = "root@pam";
|
|
|
|
|
2019-09-16 10:35:23 +00:00
|
|
|
let client = HttpClient::new(host, username, None)?;
|
2019-05-16 08:24:23 +00:00
|
|
|
|
2019-07-25 11:44:01 +00:00
|
|
|
let backup_time = chrono::Utc::now();
|
|
|
|
|
2019-10-12 11:53:11 +00:00
|
|
|
let client = BackupWriter::start(client, datastore, "host", "speedtest", backup_time, false).await?;
|
2019-05-16 08:24:23 +00:00
|
|
|
|
2019-05-23 05:20:05 +00:00
|
|
|
println!("start upload speed test");
|
2019-08-29 07:58:20 +00:00
|
|
|
let res = client.upload_speedtest().await?;
|
2019-05-16 08:24:23 +00:00
|
|
|
|
|
|
|
Ok(res)
|
|
|
|
}
|
|
|
|
|
2019-08-29 07:58:20 +00:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
match upload_speed().await {
|
|
|
|
Ok(mbs) => {
|
|
|
|
println!("average upload speed: {} MB/s", mbs);
|
|
|
|
}
|
|
|
|
Err(err) => {
|
|
|
|
eprintln!("ERROR: {}", err);
|
2019-05-16 08:24:23 +00:00
|
|
|
}
|
2019-08-29 07:58:20 +00:00
|
|
|
}
|
2019-05-16 08:24:23 +00:00
|
|
|
}
|