Skip to content

Commit 8fcb6b7

Browse files
committed
test(eval): cover json judge failure report
1 parent 757c236 commit 8fcb6b7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/eval_run_e2e.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,22 @@ sleep 60
152152
assert_eq!(json["done"], true);
153153
assert!(json["judges"].as_array().is_some());
154154

155+
let fail_cell = cell.join("fail.kdl");
156+
let fail_spec = std::fs::read_to_string(cell.join("cell.kdl")).unwrap()
157+
.replace("test -f $CATALOG/worker/DONE", "test -f $CATALOG/worker/NOPE");
158+
std::fs::write(&fail_cell, fail_spec).unwrap();
159+
let fail_out = Command::new(bin)
160+
.args(["eval", "--json"])
161+
.arg(&fail_cell)
162+
.env("PATH", &path)
163+
.env_remove("CATALOG").env_remove("ST_ROOT").env_remove("PTY_ROOT")
164+
.env("XDG_STATE_HOME", tmp.path().join("xdg-fail"))
165+
.output().unwrap();
166+
assert!(!fail_out.status.success());
167+
let fail_json: serde_json::Value = serde_json::from_slice(&fail_out.stdout).expect("failed eval report");
168+
assert_eq!(fail_json["judges"][0]["passed"], false);
169+
assert!(!String::from_utf8_lossy(&fail_out.stdout).contains("=="));
170+
155171
let invalid = Command::new(bin)
156172
.args(["eval", "--json"])
157173
.arg(tmp.path().join("missing.kdl"))

0 commit comments

Comments
 (0)