test: fix weak and incorrect assertions in pr_filters tests#1151
Draft
github-actions[bot] wants to merge 1 commit into
Draft
test: fix weak and incorrect assertions in pr_filters tests#1151github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Five fixes in src/compile/pr_filters.rs:
- test_gate_step_commit_message: pattern.contains("skip-agent") was too
weak and would pass for many wrong patterns; replace with
- test_gate_step_change_count_includes_changed_files_fact: test name claims
to verify that ChangedFileCount transitively depends on ChangedFiles, but
the body also added an explicit changed_files filter — masking the
dependency entirely. Remove that filter so only min_changes is set and
changed_files can only appear via the declared dependency.
- test_gate_step_build_reason_include: match arm used .. to skip the fact
field, so a regression that wired the wrong fact would go undetected.
- test_gate_step_build_reason_exclude: same issue as above for
- test_gate_step_labels_none_of: was missing both check.name and fact
assertions that the symmetric test_gate_step_labels_any_of already
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Suite Reduction:
src/compile/pr_filters.rsWhat was wrong
test_gate_step_commit_message:assert!(pattern.contains("skip-agent"))is too weak — it passes for any pattern containing that substring, including one with the wildcards stripped. The pattern"*[skip-agent]*"must survive round-trip unchanged.test_gate_step_change_count_includes_changed_files_fact: Test name claims to verify thatChangedFileCounttransitively depends onChangedFiles, but the body also set an explicitchanged_filesfilter — sochanged_filesappeared inspec.factsregardless of the dependency. A regression removing the dependency declaration would have gone undetected.test_gate_step_build_reason_include: Match arm used..to silently skip thefactfield insideValueInSet. A regression wiring the wrong fact (e.g."pr_title"instead of"build_reason") would not have been caught.test_gate_step_build_reason_exclude: Same issue in theValueNotInSetarm.test_gate_step_labels_none_of: Missingcheck.nameandfactassertions. The symmetrictest_gate_step_labels_any_ofalready checked both; this variant was inconsistently weaker.Changes
test_gate_step_commit_messagecontains→assert_eq!on full patterntest_gate_step_change_count_includes_changed_files_factchanged_filesfilter so test exercises the declared dependencytest_gate_step_build_reason_includeassert_eq!(fact, "build_reason")test_gate_step_build_reason_excludeassert_eq!(fact, "build_reason")test_gate_step_labels_none_ofcheck.nameandfactassertions for consistencyVerification
cargo test: 2123 tests pass, 0 failed ✅cargo clippy --all-targets --all-features: no warnings ✅Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.