test: improve CEL validator coverage#214
Merged
sivchari merged 2 commits intosivchari:mainfrom Feb 23, 2026
Merged
Conversation
Add comprehensive test cases for CEL validation: - 8 test cases in TestCELValidation covering age boundaries, empty name, is_active false state - TestCELValidationNil for nil pointer handling This improves coverage of marker_cel_validator.go and strengthens edge case handling.
sivchari
reviewed
Feb 12, 2026
test/unit/cel_test.go
Outdated
| if err == nil { | ||
| t.Error("expected error for nil CEL, got nil") | ||
| } | ||
| if err.Error() != "input CEL is nil" { |
Owner
There was a problem hiding this comment.
Why don't you use ErrNilCEL to assert error ?
You can write it like this
if !errors.Is(err, test.ErrNilCEL) {}
Contributor
🔍 Fuzz Testing Results✅ FuzzIsValidEmail: Passed (15 seconds) 🎉 All fuzz tests passed! The changes don't introduce any obvious issues. Note: This was a quick 15-second fuzz test. More extensive testing runs on the main branch. |
Contributor
📊 Coverage ReportTotal Coverage: 83.2% DetailsRun |
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.
Description
Add comprehensive test cases for CEL validation:
This improves coverage of
marker_cel_validator.goand strengthens edge case handling.Type of Change
Quality Checklist
Before submitting this pull request, ensure your contribution meets these quality standards:
Code Quality
make golangci-lintwithout errorsmake testTesting Requirements
internal/analyzers/govalid/testdata/)test/unit/)test/benchmark/)cd test && go generatePerformance Standards
test/benchmark/README.mdDocumentation
Integration
make generate-validator MARKER=yourmarkergo install ./cmd/govalid/Final Verification
Additional Notes
https://app.codecov.io/gh/sivchari/govalid/blob/main/test%2Fmarker_cel_validator.go
Related Issues
#132