Skip to content

Commit c6adf9e

Browse files
test: remove duplicate PR trigger test in pr_filters (#804)
test_generate_pr_trigger_with_pr_trigger_and_pipeline_trigger was a duplicate of test_generate_pr_trigger_with_explicit_pr_trigger_overrides_schedule. Both tests verify the same behavior: when triggers.pr is explicitly set, generate_pr_trigger returns early at line 499 of src/compile/common.rs, bypassing the schedule/pipeline suppression logic. The presence of pipeline: Some(...) vs pipeline: None in the OnConfig setup does not affect the code path taken, since the function checks has_pipeline_trigger only after the explicit pr: early return. The remaining test has been renamed to _overrides_suppression (instead of _overrides_schedule) and its comments now document that it covers both the schedule and pipeline suppression cases. Test count: 32 → 31 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1f3929b commit c6adf9e

1 file changed

Lines changed: 5 additions & 23 deletions

File tree

src/compile/pr_filters.rs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -114,37 +114,19 @@ mod tests {
114114
}
115115

116116
#[test]
117-
fn test_generate_pr_trigger_with_explicit_pr_trigger_overrides_schedule() {
117+
fn test_generate_pr_trigger_with_explicit_pr_trigger_overrides_suppression() {
118118
let triggers = Some(OnConfig {
119119
pipeline: None,
120120
pr: Some(PrTriggerConfig::default()),
121121
schedule: None,
122122
});
123123
let result = generate_pr_trigger(&triggers, true);
124124
// PrTriggerConfig::default() has no branches/paths, so the native block is empty
125-
// (meaning "trigger on all PRs" in ADO). The schedule suppression ("pr: none") must
126-
// NOT be emitted because the explicit pr: key overrides it.
125+
// (meaning "trigger on all PRs" in ADO). The schedule/pipeline suppression ("pr: none")
126+
// must NOT be emitted because the explicit pr: key overrides it — regardless of whether
127+
// has_schedule or has_pipeline_trigger is set.
127128
assert!(result.is_empty(), "default PrTriggerConfig should produce empty string (trigger on all PRs)");
128-
assert!(!result.contains("pr: none"), "triggers.pr should override schedule suppression");
129-
}
130-
131-
#[test]
132-
fn test_generate_pr_trigger_with_pr_trigger_and_pipeline_trigger() {
133-
let triggers = Some(OnConfig {
134-
pipeline: Some(PipelineTrigger {
135-
name: "Build".into(),
136-
project: None,
137-
branches: vec![],
138-
filters: None,
139-
}),
140-
pr: Some(PrTriggerConfig::default()),
141-
schedule: None,
142-
});
143-
let result = generate_pr_trigger(&triggers, false);
144-
// Same as above: default PrTriggerConfig → empty (trigger on all PRs).
145-
// Pipeline-only suppression must NOT be emitted because pr: is explicit.
146-
assert!(result.is_empty(), "default PrTriggerConfig should produce empty string (trigger on all PRs)");
147-
assert!(!result.contains("pr: none"), "triggers.pr should override pipeline trigger suppression");
129+
assert!(!result.contains("pr: none"), "triggers.pr should override schedule/pipeline suppression");
148130
}
149131

150132
#[test]

0 commit comments

Comments
 (0)