Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(saas_isolation): record first error per method in run summary

Steven Enamakeld8dd47d41ffe
diff --git a/tests/saas_isolation/world.rs b/tests/saas_isolation/world.rs
index 3ae5013d7d..7fcb6102bf 100644
--- a/tests/saas_isolation/world.rs
+++ b/tests/saas_isolation/world.rs
@@ -148,6 +148,8 @@ pub struct World {
pub trace: Vec<String>,
/// Per method: (answered with a result, answered with an error, other status).
pub stats: BTreeMap<String, (u32, u32, u32)>,
+ /// The first error each method answered, for the run summary.
+ pub first_error: BTreeMap<String, String>,
}
impl World {
@@ -166,6 +168,7 @@ impl World {
streams: 0,
trace: Vec::new(),
stats: BTreeMap::new(),
+ first_error: BTreeMap::new(),
}
}
diff --git a/tests/saas_profile_isolation_e2e.rs b/tests/saas_profile_isolation_e2e.rs
index 6300a7ce6c..f684bd762d 100644
--- a/tests/saas_profile_isolation_e2e.rs
+++ b/tests/saas_profile_isolation_e2e.rs
@@ -78,7 +78,13 @@ fn act(w: &mut World, actor: usize, method: &str, params: Value) -> Value {
let stat = w.stats.entry(method.to_string()).or_default();
match (status, body.get("result").is_some()) {
(200, true) => stat.0 += 1,
- (200, false) => stat.1 += 1,
+ (200, false) => {
+ stat.1 += 1;
+ let message = body["error"]["message"].as_str().unwrap_or_default();
+ w.first_error
+ .entry(method.to_string())
+ .or_insert_with(|| message.chars().take(90).collect());
+ }
_ => stat.2 += 1,
}
if status != 200 {
@@ -296,7 +302,10 @@ fn random_cross_profile_calls_never_leak() {
assert!(own.iter().all(|&n| n > 0), "every user's tree holds their own data: {own:?}");
let summary: Vec<String> = w.stats.iter()
- .map(|(m, (ok, err, other))| format!(" {m}: ok {ok} err {err} other {other}"))
+ .map(|(m, (ok, err, other))| {
+ let first = w.first_error.get(m).map(String::as_str).unwrap_or("");
+ format!(" {m}: ok {ok} err {err} other {other} {first}")
+ })
.collect();
eprintln!(
"[isolation] seed {seed}: {steps} steps; boot+seed {:.1}s, drive {:.1}s, total {:.1}s; \