Skip to content

test: fix vacuous is_err() assertions in runtime extension tests#1568

Merged
jamesadevine merged 1 commit into
mainfrom
test/fix-vacuous-is-err-in-runtimes-6da44c2d0b407281
Jul 21, 2026
Merged

test: fix vacuous is_err() assertions in runtime extension tests#1568
jamesadevine merged 1 commit into
mainfrom
test/fix-vacuous-is-err-in-runtimes-6da44c2d0b407281

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/runtimes/ extension tests

What was wrong

Six tests across the node, python, and dotnet runtime extensions used bare assert!(ext.declarations(...).is_err()). A bare is_err() assertion only confirms that some error was returned — it would pass even if a completely unrelated error fired (e.g. a parse error, a panic converted to anyhow, or an unrelated validation failure). None of these tests verified the error was actually the expected one for the scenario they described.

Changes

File Test Action Reason
src/runtimes/node/extension.rs test_validate_invalid_feed_url_rejected Rewritten bare is_err()unwrap_err() + assert message contains https:// scheme text and runtimes.node.feed-url
src/runtimes/node/extension.rs test_validate_version_injection_rejected Rewritten bare is_err()unwrap_err() + assert message contains ADO expression and runtimes.node.version
src/runtimes/python/extension.rs test_validate_invalid_feed_url_rejected Rewritten bare is_err()unwrap_err() + assert message contains https:// and runtimes.python.feed-url
src/runtimes/python/extension.rs test_validate_version_injection_rejected Rewritten bare is_err()unwrap_err() + assert message contains ADO expression and runtimes.python.version
src/runtimes/dotnet/extension.rs test_validate_invalid_feed_url_rejected Rewritten bare is_err()unwrap_err() + assert message contains ADO expression and runtimes.dotnet.feed-url
src/runtimes/dotnet/extension.rs test_validate_version_injection_rejected Rewritten bare is_err()unwrap_err() + assert message contains ADO expression and runtimes.dotnet.version

Verification

  • cargo test: all tests pass ✅
  • No regressions introduced ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · 68.1 AIC · ⌖ 12.3 AIC · ⊞ 8.7K ·

Upgrade 6 bare is_err() calls (node, python, dotnet) to unwrap_err()
with message-content assertions. Each test now verifies the correct
error variant fires — the right field name and cause are included —
so a future regression that returns a different error (or no error)
would be caught rather than silently accepted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine
jamesadevine marked this pull request as ready for review July 21, 2026 13:44
@jamesadevine
jamesadevine merged commit 9fa5cf1 into main Jul 21, 2026
2 of 4 checks passed
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