feat: Fix formatting, type conversion, and test assertions in middleware and monitoring modules

- Add fmt import and fix X-RateLimit-Limit header conversion from rune to string in ratelimit middleware
- Fix whitespace alignment for rate limiter variable declarations and JSON error responses
- Update mock expectations in redis_ratelimit_test to use explicit argument type matchers
- Add severity validation check in alerting_test rule validation
- Fix health_test assertions for degraded/unhealthy counts
This commit is contained in:
nutcas3
2026-04-25 01:07:52 +03:00
parent 9d3b8428bd
commit 79f217ff1b
4 changed files with 45 additions and 39 deletions
@@ -329,8 +329,13 @@ func TestAlertRule_Validation(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Basic validation - check if required fields are set
isValid := tt.rule.ID != "" && tt.rule.Name != "" && tt.rule.Query != ""
// Basic validation - check if required fields are set and severity is valid
validSeverities := map[string]bool{
string(SeverityInfo): true,
string(SeverityWarning): true,
string(SeverityCritical): true,
}
isValid := tt.rule.ID != "" && tt.rule.Name != "" && tt.rule.Query != "" && validSeverities[string(tt.rule.Severity)]
assert.Equal(t, tt.isValid, isValid)
})
}