test(conf): add comprehensive validation tests for Load function#5388
Merged
kevwan merged 2 commits intozeromicro:masterfrom Jan 24, 2026
Merged
test(conf): add comprehensive validation tests for Load function#5388kevwan merged 2 commits intozeromicro:masterfrom
kevwan merged 2 commits intozeromicro:masterfrom
Conversation
Add tests to verify validation behavior is consistent between normal loading and UseEnv() paths. This ensures the fix from PR zeromicro#5372 is properly covered and prevents future regressions. Tests added: - TestLoadValidation_WithoutEnv: validates normal loading path - TestLoadValidation_WithEnv: validates UseEnv() path - TestLoadValidation_Consistency: ensures both paths behave identically Related to zeromicro#5369
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test coverage for the validation behavior in the conf.Load() function to ensure consistency between normal loading and the UseEnv() path. The tests verify the fix from PR #5372, which addressed issue #5369 where validation was called twice in the normal path but only once with UseEnv().
Changes:
- Added
validatorConfigtest helper struct implementingvalidation.Validatorinterface - Added three test functions covering validation behavior in normal loading, UseEnv loading, and consistency between both paths
- Tests cover all three supported config formats: JSON, YAML, and TOML
Remove unused invalidValue constant that was flagged by reviewdog linter.
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.
Add tests to verify validation behavior is consistent between normal loading and UseEnv() paths. This ensures the fix from PR #5372 is properly covered and prevents future regressions.
Tests added:
Related to #5369