mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-04 02:42:17 +00:00
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:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user