From 3346dac4dc3aa7a44d6a5fb9fd26e5a618de0a98 Mon Sep 17 00:00:00 2001 From: marcinlawnik Date: Fri, 16 Feb 2024 11:17:33 +0100 Subject: [PATCH] format --- manifest/v1alpha/slo/validation.go | 4 +--- manifest/v1alpha/slo/validation_test.go | 18 +++--------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/manifest/v1alpha/slo/validation.go b/manifest/v1alpha/slo/validation.go index 90163c236..43351e9b4 100644 --- a/manifest/v1alpha/slo/validation.go +++ b/manifest/v1alpha/slo/validation.go @@ -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, ), ) @@ -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"). diff --git a/manifest/v1alpha/slo/validation_test.go b/manifest/v1alpha/slo/validation_test.go index 943da600f..407ee8335 100644 --- a/manifest/v1alpha/slo/validation_test.go +++ b/manifest/v1alpha/slo/validation_test.go @@ -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() @@ -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{