Skip to content

test(conf): add comprehensive validation tests for Load function#5388

Merged
kevwan merged 2 commits intozeromicro:masterfrom
kevwan:chore/addmoretest
Jan 24, 2026
Merged

test(conf): add comprehensive validation tests for Load function#5388
kevwan merged 2 commits intozeromicro:masterfrom
kevwan:chore/addmoretest

Conversation

@kevwan
Copy link
Contributor

@kevwan kevwan commented Jan 24, 2026

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:

  • TestLoadValidation_WithoutEnv: validates normal loading path
  • TestLoadValidation_WithEnv: validates UseEnv() path
  • TestLoadValidation_Consistency: ensures both paths behave identically

Related to #5369

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
Copilot AI review requested due to automatic review settings January 24, 2026 16:05
@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
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

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 validatorConfig test helper struct implementing validation.Validator interface
  • 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.
@kevwan kevwan merged commit b20f0e3 into zeromicro:master Jan 24, 2026
6 checks passed
@kevwan kevwan deleted the chore/addmoretest branch January 24, 2026 23:21
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