Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(operator): fix linter issues #579

Merged
merged 14 commits into from
Jan 12, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
)

// ConvertTo converts the src v1alpha1.KeptnAppVersion to the hub version (v1alpha2.KeptnAppVersion)
//
//nolint:gocyclo
func (src *KeptnAppVersion) ConvertTo(dstRaw conversion.Hub) error {
dst, ok := dstRaw.(*v1alpha2.KeptnAppVersion)

Expand Down Expand Up @@ -121,6 +123,8 @@ func (src *KeptnAppVersion) ConvertTo(dstRaw conversion.Hub) error {
}

// ConvertFrom converts from the hub version (v1alpha2.KeptnAppVersion) to this version (v1alpha1.KeptnAppVersion)
//
//nolint:gocyclo
func (dst *KeptnAppVersion) ConvertFrom(srcRaw conversion.Hub) error {
src, ok := srcRaw.(*v1alpha2.KeptnAppVersion)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:dupl
package v1alpha1

import (
Expand Down
2 changes: 2 additions & 0 deletions operator/apis/lifecycle/v1alpha1/keptnappversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//nolint:dupl
func TestKeptnAppVersion(t *testing.T) {
app := &KeptnAppVersion{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -244,6 +245,7 @@ func TestKeptnAppVersion_GetWorkloadNameOfApp(t *testing.T) {
}
}

//nolint:dupl
func TestKeptnAppVersion_CancelRemainingPhases(t *testing.T) {
app := KeptnAppVersion{
Status: KeptnAppVersionStatus{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package v1alpha1

import (
"fmt"
"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common"
corev1 "k8s.io/api/core/v1"

"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common"
"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2"
corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package v1alpha1

import (
"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common"
corev1 "k8s.io/api/core/v1"
v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2"
"testing"

"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha1/common"
"github.com/keptn/lifecycle-toolkit/operator/apis/lifecycle/v1alpha2"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/apis/meta/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v2 "sigs.k8s.io/controller-runtime/pkg/webhook/conversion/testdata/api/v2"
)

func TestKeptnEvalProvider_ConvertFrom(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:dupl
package v1alpha1

import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//nolint:dupl
func TestKeptnWorkloadInstance(t *testing.T) {
workload := &KeptnWorkloadInstance{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -217,6 +218,7 @@ func TestKeptnWorkloadInstance(t *testing.T) {
}, workload.GetSpanAttributes())
}

//nolint:dupl
func TestKeptnWorkloadInstance_CancelRemainingPhases(t *testing.T) {
workloadInstance := KeptnWorkloadInstance{
Status: KeptnWorkloadInstanceStatus{
Expand Down
1 change: 1 addition & 0 deletions operator/apis/lifecycle/v1alpha2/keptnappversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func TestKeptnAppVersion_GetWorkloadNameOfApp(t *testing.T) {
}
}

//nolint:dupl
func TestKeptnAppVersion_DeprecateRemainingPhases(t *testing.T) {
app := KeptnAppVersion{
Status: KeptnAppVersionStatus{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ func (v KeptnAppVersion) GetWorkloadNameOfApp(workloadName string) string {
return fmt.Sprintf("%s-%s", v.Spec.AppName, workloadName)
}

//nolint:dupl
func (a *KeptnAppVersion) DeprecateRemainingPhases(phase common.KeptnPhaseType) {
// no need to deprecate anything when post-eval tasks fail
if phase == common.PhaseAppPostEvaluation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ func TestKeptnWorkloadInstance(t *testing.T) {
}, workload.GetSpanAttributes())
}

//nolint:dupl
func TestKeptnWorkloadInstance_DeprecateRemainingPhases(t *testing.T) {
workloadInstance := KeptnWorkloadInstance{
Status: KeptnWorkloadInstanceStatus{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func (w KeptnWorkloadInstance) SetSpanAttributes(span trace.Span) {
span.SetAttributes(w.GetSpanAttributes()...)
}

//nolint:dupl
func (w *KeptnWorkloadInstance) DeprecateRemainingPhases(phase common.KeptnPhaseType) {
// no need to deprecate anything when post-eval tasks fail
if phase == common.PhaseWorkloadPostEvaluation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,13 +360,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -383,13 +383,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -406,13 +406,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -429,13 +429,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -393,13 +393,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -416,13 +416,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand All @@ -439,13 +439,13 @@ spec:
items:
properties:
definitionName:
description: name of EvaluationDefinition/TaskDefiniton
description: DefinitionName is the name of the EvaluationDefinition/TaskDefiniton
type: string
endTime:
format: date-time
type: string
name:
description: name of Evaluation/Task
description: Name is the name of the Evaluation/Task
type: string
startTime:
format: date-time
Expand Down
Loading