Conversation
- Add 85+ test cases covering all validation patterns - Test container image format validation (valid/invalid formats) - Test mount pattern validation (ro/rw modes, edge cases) - Test entrypoint whitespace validation - Test HTTP URL pattern validation - Test gateway port range validation (1-65535) - Test gateway domain validation (localhost, host.docker.internal, variables) - Test timeout validation (positive integers only) - Add edge cases: empty configs, multiple servers, nil values - Use testify assertions (assert/require) consistently - Add comprehensive error message validation Targets: internal/config/validation_schema.go:validateStringPatterns() Previous coverage: 0% Focus: Critical configuration validation with security implications
Contributor
Author
Smoke Test ResultsPR #449: Add framework for WASM DIFC guards (in-process, Go 1.23 + TinyGo) ✅ GitHub MCP Status: PASS @github-actions
|
This was referenced Jan 25, 2026
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 Coverage Improvement: validateStringPatterns()
Function Analyzed
internal/configvalidateStringPatterns()invalidation_schema.go(lines 369-462)Why This Function?
validateStringPatterns()was selected as the most critical under-tested function because:A bug in this function could:
Tests Added
Created
validation_string_patterns_test.gowith 85+ comprehensive test cases organized into 10 test suites:✅ Container Pattern Validation (12 tests)
✅ Mount Pattern Validation (8 tests)
✅ Entrypoint Validation (7 tests)
✅ URL Pattern Validation (8 tests)
✅ Gateway Port Validation (10 tests)
✅ Gateway Domain Validation (13 tests)
${VAR_NAME}format (uppercase, underscores, numbers)✅ Gateway Timeout Validation (10 tests)
✅ Multiple Servers (2 tests)
✅ Edge Cases (6 tests)
✅ Error Message Quality (3 tests)
mcpServers.my-server.containermounts[1]Testing Best Practices
All tests follow Go and project conventions:
t.Run()for clear organizationassert/require) throughoutassert := assert.New(t)) for cleaner codeassert.NoErrorvsassert.Nilfor errors)intPtr) for test data constructionCoverage Report
Before:
After:
Test Execution
Branch:
test-coverage/validation-string-patternsCommit:
359ba3dAll tests structured correctly:
validation_schema_test.goTestValidateStringPatternsComprehensive)Impact
This PR significantly improves test coverage for critical configuration validation logic:
Next Steps
After merge, future test coverage improvements could target:
formatValidationErrorRecursive()- Complex error formatting (0% coverage)WrapToolHandler()ininternal/middleware/jqschema.go- Middleware logic (0% coverage)createFilteredServer()ininternal/server/routed.go- Partial coverage, needs edge casesGenerated by: Test Coverage Improver Agent
Analysis Date: 2026-01-24
Focus: Critical under-tested functions with high complexity