Skip to content

Commit

Permalink
modify step condition
Browse files Browse the repository at this point in the history
Signed-off-by: Rakshit Gondwal <[email protected]>
  • Loading branch information
rakshitgondwal committed Jul 21, 2023
1 parent e61b9f8 commit a991ce1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion metrics-operator/api/v1alpha3/keptnmetric_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (s *KeptnMetric) validateRangeInterval() *field.Error {
}

func (s *KeptnMetric) validateRangeStep() *field.Error {
if s.Spec.Range == nil {
if s.Spec.Range == nil || s.Spec.Range.Step == "" {
return nil
}
_, err := time.ParseDuration(s.Spec.Range.Step)
Expand Down
11 changes: 0 additions & 11 deletions metrics-operator/api/v1alpha3/keptnmetric_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,6 @@ func TestKeptnMetric_validateRangeStep(t *testing.T) {
Step: "",
},
},
want: apierrors.NewInvalid(
schema.GroupKind{Group: "metrics.keptn.sh", Kind: "KeptnMetric"},
"create-with-empty-step",
field.ErrorList{
field.Invalid(
field.NewPath("spec").Child("range").Child("step"),
"",
"Forbidden! The time interval cannot be parsed. Please check for suitable conventions",
),
},
),
},
{
name: "create-with-right-step",
Expand Down

0 comments on commit a991ce1

Please sign in to comment.