Skip to content

test: fix vacuous assertion in mcp_http_tests#1557

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/mcp-http-auth-assertion-5f616eb183ba2f60
Jul 21, 2026
Merged

test: fix vacuous assertion in mcp_http_tests#1557
jamesadevine merged 1 commit into
mainfrom
test-reducer/mcp-http-auth-assertion-5f616eb183ba2f60

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: tests/mcp_http_tests.rs

What was wrong

  • test_auth_accepts_correct_token: the assertion assert_ne!(resp.status(), 401, "Correct API key should not be rejected") is vacuous — it passes on any response that isn't a 401, including 400 Bad Request, 500 Internal Server Error, etc. The test name implies the server accepts the token (i.e. returns a success response), but the assertion only verifies it was not rejected with a 401. A bug that caused the server to crash on valid tokens would go undetected.

Changes

Test Action Reason
test_auth_accepts_correct_token Rewritten Vacuous negative assertion replaced with assert!(status.is_success())

Verification

  • cargo test --test mcp_http_tests: all 8 tests pass ✅
  • cargo check --tests: no errors ✅

Generated by Test Reducer · 71.3 AIC · ⌖ 11.6 AIC · ⊞ 8.7K ·

test_auth_accepts_correct_token used assert_ne!(status, 401) which
passes even on 500 errors. Replace with assert!(status.is_success())
so the test actually verifies the server accepts the correct token.

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 5419b21 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