Skip to content

test: reduce and improve tests in src/validate.rs#649

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/validate-rs-20260519-1f266bf0e7e2ac96
May 19, 2026
Merged

test: reduce and improve tests in src/validate.rs#649
jamesadevine merged 1 commit into
mainfrom
test-reducer/validate-rs-20260519-1f266bf0e7e2ac96

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/validate.rs

What was wrong

  • test_reject_pipeline_injection: Two consecutive assertions both tested the contains_template_marker branch — \{\{ 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 through reject_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 asserted warnings.len() >= 2 and checked warnings[0] but never verified warnings[1], so the sensitive-path sub-warning from validate_mount_source was 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 Action Reason
test_reject_pipeline_injection Rewritten (one assertion replaced) Duplicate template-marker assertion → add untested $[variables.x] runtime expression form
test_validate_container_image Rewritten .is_empty() only → verify warning message content for both invalid cases
test_validate_docker_args_volume_flag_calls_mount_validation Rewritten Missing assertion on warnings[1] sensitive-path content
test_validate_mcp_url Rewritten .is_empty() only → verify warning message mentions expected schemes
test_validate_feed_url_rejects_double_quote + test_validate_feed_url_rejects_single_quote Merged → test_validate_feed_url_rejects_quotes Two single-assertion tests for the same feature

Verification

  • cargo test: 1602 tests pass, 0 failed ✅
  • cargo clippy --all-targets --all-features: no new warnings ✅

Generated by Test Reducer · ● 1.4M ·

- 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>
@jamesadevine jamesadevine marked this pull request as ready for review May 19, 2026 14:01
@jamesadevine jamesadevine merged commit 3a0c9e7 into main May 19, 2026
@jamesadevine jamesadevine deleted the test-reducer/validate-rs-20260519-1f266bf0e7e2ac96 branch May 19, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant