Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions stresstest/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,18 @@ impl HttpRemote {
Ok(())
}

pub(crate) async fn delete(&self, usecase: &Usecase, organization_id: u64, key: &str) {
pub(crate) async fn delete(
&self,
usecase: &Usecase,
organization_id: u64,
key: &str,
) -> anyhow::Result<()> {
self.session(usecase, organization_id)
.delete(key)
.send()
.await
.unwrap();
.await?;

Ok(())
}

fn session(&self, usecase: &Usecase, organization_id: u64) -> Session {
Expand Down
22 changes: 17 additions & 5 deletions stresstest/src/stresstest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::fmt;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};

use anyhow::Result;
use anyhow::{Error, Result};

use bytesize::ByteSize;
use futures::StreamExt;
Expand Down Expand Up @@ -190,7 +190,10 @@ impl Stresstest {
let bar = &bar;
async move {
let start = Instant::now();
remote.delete(usecase, *organization_id, object_key).await;
remote
.delete(usecase, *organization_id, object_key)
.await
.unwrap();
cleanup_timing
.lock()
.unwrap()
Expand Down Expand Up @@ -285,7 +288,7 @@ async fn run_workload(
metrics.bytes_written += file_size;
}
Err(err) => {
eprintln!("error writing object: {err}");
print_error("writing object", &err);
let mut metrics = metrics.lock().unwrap();
metrics.write_failures += 1;
}
Expand All @@ -302,15 +305,17 @@ async fn run_workload(
metrics.bytes_read += file_size;
}
Err(err) => {
eprintln!("error reading object: {err}");
print_error("reading object", &err);
let mut metrics = metrics.lock().unwrap();
metrics.read_failures += 1;
}
}
}
Action::Delete(external_id) => {
let (usecase, organization_id, object_key) = &external_id;
remote.delete(usecase, *organization_id, object_key).await;
if let Err(err) = remote.delete(usecase, *organization_id, object_key).await {
print_error("deleting object", &err);
}
let mut metrics = metrics.lock().unwrap();
metrics.delete_timing.add(start.elapsed().as_secs_f64());
}
Expand Down Expand Up @@ -342,6 +347,13 @@ async fn run_workload(
(workload, metrics)
}

fn print_error(message: &str, error: &Error) {
eprintln!("{} {}", "ERROR:".bold().red(), message.bold());
for source in error.chain() {
eprintln!(" {}: {source}", "caused by".italic());
}
}

fn print_metrics(metrics: &WorkloadMetrics, duration: Duration) {
let sketch = &metrics.file_sizes;
if sketch.count() > 0 {
Expand Down