Skip to content

Commit fa91595

Browse files
committed
Cover parent and inline trigger overlap
1 parent 041f7b6 commit fa91595

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

src/config.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,6 +1031,46 @@ mod tests {
10311031
.expect("independent inline triggers should be allowed");
10321032
}
10331033

1034+
#[test]
1035+
fn validate_rejects_inline_workflow_trigger_overlapping_with_parent_trigger() {
1036+
let mut config = base_config();
1037+
config.workflow.insert(
1038+
"c".into(),
1039+
WorkflowSpec {
1040+
steps: vec![WorkflowStep::NotifyReload],
1041+
triggers: vec![],
1042+
},
1043+
);
1044+
config.workflow.insert(
1045+
"b".into(),
1046+
WorkflowSpec {
1047+
steps: vec![WorkflowStep::Log {
1048+
message: "b".into(),
1049+
style: LogStyle::Plain,
1050+
}],
1051+
triggers: vec!["c".into()],
1052+
},
1053+
);
1054+
config.workflow.insert(
1055+
"a".into(),
1056+
WorkflowSpec {
1057+
steps: vec![WorkflowStep::RunWorkflow {
1058+
workflow: "b".into(),
1059+
}],
1060+
triggers: vec!["c".into()],
1061+
},
1062+
);
1063+
1064+
let error = config.workflow["a"]
1065+
.validate(&config, "a")
1066+
.expect_err("overlapping parent and inline workflow triggers should fail");
1067+
assert!(
1068+
error.to_string().contains(
1069+
"workflow 'c' is reachable both as a trigger target and via run_workflow"
1070+
)
1071+
);
1072+
}
1073+
10341074
#[test]
10351075
fn output_config_defaults_to_inherited_output() {
10361076
let config: OutputConfig = toml::from_str("").expect("parse default output config");

0 commit comments

Comments
 (0)