test: reduce and improve tests in src/validate.rs#649
Merged
jamesadevine merged 1 commit intoMay 19, 2026
Conversation
- test_reject_pipeline_injection: replace duplicate {{ copilot_params }}
template-marker assertion with $[variables.x] runtime expression,
covering the untested $[ ADO expression form
- test_validate_container_image: add message-content assertions for both
invalid cases (is_empty() alone did not verify the warning reason)
- test_validate_docker_args_volume_flag_calls_mount_validation: assert on
warnings[1] content to verify the sensitive-path sub-warning is generated
- test_validate_mcp_url: assert the warning message mentions the expected
schemes instead of only checking is_empty()
- test_validate_feed_url_rejects_double_quote +
test_validate_feed_url_rejects_single_quote: merge into single
test_validate_feed_url_rejects_quotes (two trivially single-assertion
tests for the same feature)
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/validate.rsWhat was wrong
test_reject_pipeline_injection: Two consecutive assertions both tested thecontains_template_markerbranch —\{\{ agent_content }}and\{\{ copilot_params }}trigger exactly the same code path. The second assertion was a duplicate; meanwhile the$[...]ADO runtime expression form was never exercised throughreject_pipeline_injection.test_validate_container_image: Both invalid-input branches were checked only with.is_empty(). The warning message itself — which contains the specific reason (empty name / unexpected characters) — was never asserted. A regression that changed the message to a different string would go undetected.test_validate_docker_args_volume_flag_calls_mount_validation: The test assertedwarnings.len() >= 2and checkedwarnings[0]but never verifiedwarnings[1], so the sensitive-path sub-warning fromvalidate_mount_sourcewas effectively untested.test_validate_mcp_url: The invalid-URL case was checked only with.is_not_empty(). The warning message — which explains which schemes are acceptable — was never asserted.test_validate_feed_url_rejects_double_quote+test_validate_feed_url_rejects_single_quote: Two separate test functions each containing a single assertion for the same feature (quote rejection in feed URLs). Unnecessarily split.Changes
test_reject_pipeline_injection$[variables.x]runtime expression formtest_validate_container_image.is_empty()only → verify warning message content for both invalid casestest_validate_docker_args_volume_flag_calls_mount_validationwarnings[1]sensitive-path contenttest_validate_mcp_url.is_empty()only → verify warning message mentions expected schemestest_validate_feed_url_rejects_double_quote+test_validate_feed_url_rejects_single_quotetest_validate_feed_url_rejects_quotesVerification
cargo test: 1602 tests pass, 0 failed ✅cargo clippy --all-targets --all-features: no new warnings ✅