Skip to content

Commit

Permalink
Merge branch 'main' into poc/scheduling_gates
Browse files Browse the repository at this point in the history
Signed-off-by: RealAnna <89971034+RealAnna@users.noreply.github.com>
  • Loading branch information
RealAnna authored May 19, 2023
2 parents 5036c1b + f0f7edf commit aa9005e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 8 deletions.
4 changes: 4 additions & 0 deletions metrics-operator/api/v1alpha3/keptnmetric_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,7 @@ type KeptnMetricList struct {
func init() {
SchemeBuilder.Register(&KeptnMetric{}, &KeptnMetricList{})
}

func (s *KeptnMetric) IsStatusSet() bool {
return s.Status.Value != ""
}
53 changes: 53 additions & 0 deletions metrics-operator/api/v1alpha3/keptnmetric_types_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package v1alpha3

import (
"testing"

v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestKeptnMetric_IsStatusSet(t *testing.T) {
type fields struct {
TypeMeta v1.TypeMeta
ObjectMeta v1.ObjectMeta
Spec KeptnMetricSpec
Status KeptnMetricStatus
}
tests := []struct {
name string
fields fields
want bool
}{
{
name: "No value set",
fields: fields{
Status: KeptnMetricStatus{
Value: "",
},
},
want: false,
},
{
name: "we have a value",
fields: fields{
Status: KeptnMetricStatus{
Value: "1.0",
},
},
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
s := &KeptnMetric{
TypeMeta: tt.fields.TypeMeta,
ObjectMeta: tt.fields.ObjectMeta,
Spec: tt.fields.Spec,
Status: tt.fields.Status,
}
if got := s.IsStatusSet(); got != tt.want {
t.Errorf("IsStatusSet() = %v, want %v", got, tt.want)
}
})
}
}
2 changes: 1 addition & 1 deletion operator/controllers/common/fake/fakeclient.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package fake

import (
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
lfcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
optionsv1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/options/v1alpha1"
corev1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/go-logr/logr"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
"github.com/keptn/lifecycle-toolkit/operator/controllers/common"
"k8s.io/apimachinery/pkg/types"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"testing"

metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
"github.com/keptn/lifecycle-toolkit/operator/controllers/common"
"github.com/stretchr/testify/require"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"

"github.com/go-logr/logr"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common"
controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common"
Expand Down
2 changes: 1 addition & 1 deletion operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/imdario/mergo v0.3.15
github.com/kelseyhightower/envconfig v1.4.0
github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20230517124521-e381f7fc6d79
github.com/keptn/lifecycle-toolkit/metrics-operator v0.0.0-20230413082525-dd15d4a0e0e4
github.com/keptn/lifecycle-toolkit/metrics-operator v0.0.0-20230517134932-24a60f5e6f8f
github.com/magiconair/properties v1.8.7
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.6
Expand Down
2 changes: 1 addition & 1 deletion operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/certificates"
certCommon "github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/common"
"github.com/keptn/lifecycle-toolkit/klt-cert-manager/pkg/webhook"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
lifecyclev1alpha1 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1"
lifecyclev1alpha2 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2"
lifecyclev1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
Expand Down
2 changes: 1 addition & 1 deletion operator/test/component/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
"time"

metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common"
controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common"
Expand Down
2 changes: 1 addition & 1 deletion operator/test/component/evaluation/evaluation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha2"
metricsapi "github.com/keptn/lifecycle-toolkit/metrics-operator/api/v1alpha3"
klcv1alpha3 "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3"
apicommon "github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha3/common"
controllercommon "github.com/keptn/lifecycle-toolkit/operator/controllers/common"
Expand Down

0 comments on commit aa9005e

Please sign in to comment.