Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinlawnik committed Feb 16, 2024
1 parent 46d968b commit 3346dac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
4 changes: 1 addition & 3 deletions manifest/v1alpha/slo/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var specCompositeObjectiveValidationRule = validation.NewSingleRule(func(s Spec)
"objectives",
s.Objectives,
validation.NewRuleError(
fmt.Sprint("composite objective must be the only objective specified"),
"composite objective must be the only objective specified",
validation.ErrorCodeForbidden,
),
)
Expand Down Expand Up @@ -202,8 +202,6 @@ var anomalyConfigValidation = validation.New[AnomalyConfig](
)),
)

//var IndicatorValidationParent :=

var indicatorValidation = validation.New[Indicator](
validation.For(func(i Indicator) MetricSourceSpec { return i.MetricSource }).
WithName("metricSource").
Expand Down
18 changes: 3 additions & 15 deletions manifest/v1alpha/slo/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,19 +925,6 @@ func TestValidate_Spec(t *testing.T) {
Code: errCodeExactlyOneMetricType,
})
})
//t.Run("composite slo mixed with raw metric type", func(t *testing.T) {
// slo := validCompositeSLO()
// //slo.Spec.Objectives[0].RawMetric = &RawMetricSpec{
// // MetricQuery: validMetricSpec(v1alpha.Prometheus),
// //}
// //slo.Spec.Objectives[0].CountMetrics = nil
// err := validate(slo)
// fmt.Printf("%+v\n", err)
// testutils.AssertContainsErrors(t, slo, err, 1, testutils.ExpectedError{
// Prop: "spec",
// Code: errCodeExactlyOneMetricType,
// })
//})
t.Run("required time slice target for budgeting method", func(t *testing.T) {
slo := validRawMetricSLO(v1alpha.Prometheus)
slo.Spec.BudgetingMethod = BudgetingMethodTimeslices.String()
Expand Down Expand Up @@ -1207,8 +1194,9 @@ func TestValidate_CompositeSLO(t *testing.T) {

testutils.AssertContainsErrors(t, slo, err, 2,
testutils.ExpectedError{
Prop: "spec.objectives",
Code: validation.ErrorCodeSliceUnique,
Prop: "spec.objectives",
Code: validation.ErrorCodeSliceUnique,
// nolint:lll
Message: "elements are not unique, index 0 collides with index 1 based on constraints: objectives[*].value must be different for each objective",
},
testutils.ExpectedError{
Expand Down

0 comments on commit 3346dac

Please sign in to comment.