fix(#2591): validate() rejects out-of-bounds/forward parent index (argus review)
This commit is contained in:
parent
a5c321a1a0
commit
456847eaa1
2 changed files with 29 additions and 3 deletions
|
|
@ -147,6 +147,21 @@ fn unknown_dep_is_rejected_at_submit() {
|
|||
assert!(q.submit(spec).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_parent_is_rejected_at_submit() {
|
||||
let q = JobQueue::new(1);
|
||||
let mut spec = rebuild("agent-a", "bad parent");
|
||||
// A forward/out-of-bounds parent index must be refused at validate, not
|
||||
// panic in `insert_group`.
|
||||
spec.nodes = vec![NodeSpec {
|
||||
agent: "agent-a".to_owned(),
|
||||
kind: NodeKind::Reconcile,
|
||||
deps: Vec::new(),
|
||||
parent: Some(3),
|
||||
}];
|
||||
assert!(q.submit(spec).is_err());
|
||||
}
|
||||
|
||||
// ---- dependency order within a DAG ----
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue