Skip to content

Commit

Permalink
fix: PC-14236 SHR thresholds validation for less than 1 (#547)
Browse files Browse the repository at this point in the history
## Motivation

Flaky validation for System Health Review thresholds. They are not
supposed to go up to 1.

## Summary

Changed validation from LTE to LT and adjusted tests.

## Release Notes

System Health Review spec now allows for green and red thresholds to be
less than 1, not less than or equal to 1.
  • Loading branch information
lukasz-dobek committed Sep 20, 2024
1 parent 0350ad4 commit 7132d7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions manifest/v1alpha/report/validation_system_health_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ var reportThresholdsValidation = govy.New[Thresholds](
govy.ForPointer(func(s Thresholds) *float64 { return s.RedLessThanOrEqual }).
WithName("redLte").
Required().
Rules(rules.LTE(1.0)),
Rules(rules.LT(1.0)),
govy.ForPointer(func(s Thresholds) *float64 { return s.GreenGreaterThan }).
WithName("greenGt").
Required().
Rules(rules.LTE(1.0)),
Rules(rules.LT(1.0)),
)

var redLteValidation = govy.NewRule(func(v Thresholds) error {
Expand Down
2 changes: 1 addition & 1 deletion manifest/v1alpha/report/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func TestValidate_Spec_SystemHealthReview(t *testing.T) {
ExpectedErrors: []testutils.ExpectedError{
{
Prop: "spec.systemHealthReview.thresholds.greenGt",
Code: rules.ErrorCodeLessThanOrEqualTo,
Code: rules.ErrorCodeLessThan,
},
},
Config: SystemHealthReviewConfig{
Expand Down

0 comments on commit 7132d7e

Please sign in to comment.