Skip to content

fix: update auth validation test assertions to match new error format#3778

Merged
lpcox merged 1 commit intomainfrom
fix/config-auth-test-assertions
Apr 14, 2026
Merged

fix: update auth validation test assertions to match new error format#3778
lpcox merged 1 commit intomainfrom
fix/config-auth-test-assertions

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Apr 14, 2026

Problem

PR #3764 refactored auth validation into a shared validateServerAuth helper that uses rules.UnsupportedField for structured errors. This changed the error message format from the old "auth is only supported for HTTP servers" to a structured "server type \"stdio\"" with a suggestion.

Four tests were not updated to match the new format:

  • TestLoadFromFile_AuthOnNonHTTPServerRejected — expected "HTTP"
  • TestConvertStdinServerConfig_ValidationError/stdio_with_auth_block — expected old message
  • TestConvertStdinServerConfig_StdioWithAuth — expected old message in valErr.Message
  • TestValidateAuthConfig/auth_on_stdio_server_is_rejected — expected old message

Fix

Updated all 4 assertions to match the actual structured error messages from rules.UnsupportedField.

PR #3764 refactored auth validation into validateServerAuth which uses
rules.UnsupportedField, changing the error message format. Four tests
still expected the old "auth is only supported for HTTP servers" wording.

Updated assertions to match the actual structured error messages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 14, 2026 16:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates config/auth validation tests to align with the newer structured error format produced by rules.UnsupportedField (introduced via the shared validateServerAuth helper), ensuring the suite asserts against the actual message/suggestion now emitted for auth-on-non-HTTP servers.

Changes:

  • Update TestValidateAuthConfig to expect the structured message fragment server type "stdio".
  • Update stdin config conversion tests to assert on the new structured error message.
  • Update TOML LoadFromFile test to assert on the new suggestion text emitted for non-HTTP auth blocks.
Show a summary per file
File Description
internal/config/validation_test.go Adjusts auth validation test assertion to match UnsupportedField message format.
internal/config/config_stdin_test.go Updates two stdin conversion tests to expect server type "stdio" in the structured validation error.
internal/config/config_core_test.go Updates TOML load test assertion to match the new suggestion text included in the structured error.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 6a5cf86 into main Apr 14, 2026
26 checks passed
@lpcox lpcox deleted the fix/config-auth-test-assertions branch April 14, 2026 16:41
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.

2 participants