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

Fix SA1019 error by staticcheck due to deprecation #1629

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions cmd/triggerrun/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
triggersv1 "github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1"
triggersclientset "github.com/tektoncd/triggers/pkg/client/clientset/versioned"
"github.com/tektoncd/triggers/pkg/sink"
Expand Down Expand Up @@ -127,7 +126,7 @@ func Test_processTriggerSpec(t *testing.T) {
if err != nil {
t.Errorf("Cannot create a new request:%s", err)
}
taskRunTemplate := pipelinev1beta1.TaskRun{
taskRunTemplate := pipelinev1.TaskRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1alpha1",
Kind: "TaskRun",
Expand All @@ -139,8 +138,8 @@ func Test_processTriggerSpec(t *testing.T) {
"someLabel": "$(tt.params.foo)",
},
},
Spec: pipelinev1beta1.TaskRunSpec{
TaskRef: &v1beta1.TaskRef{
Spec: pipelinev1.TaskRunSpec{
TaskRef: &pipelinev1.TaskRef{
Name: "my-task", // non-existent task; just for testing
},
},
Expand Down Expand Up @@ -178,7 +177,7 @@ func Test_processTriggerSpec(t *testing.T) {
},
}

wantTaskRun := pipelinev1beta1.TaskRun{
wantTaskRun := pipelinev1.TaskRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1alpha1",
Kind: "TaskRun",
Expand All @@ -190,7 +189,7 @@ func Test_processTriggerSpec(t *testing.T) {
"someLabel": "bar", // replaced with the value of foo from bar
},
},
Spec: pipelinev1beta1.TaskRunSpec{
Spec: pipelinev1.TaskRunSpec{
TaskRef: taskRunTemplate.Spec.TaskRef, // non-existent task; just for testing
},
}
Expand Down
19 changes: 9 additions & 10 deletions pkg/apis/triggers/v1alpha1/event_listener_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"strings"
"testing"

"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/triggers/pkg/apis/triggers"
"github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1"
Expand Down Expand Up @@ -796,10 +795,10 @@ func TestEventListenerValidate_error(t *testing.T) {
Template: &v1alpha1.EventListenerTemplate{Ref: ptr.String("tt")},
Interceptors: []*v1alpha1.EventInterceptor{{
Webhook: &v1alpha1.WebhookInterceptor{
Header: []v1beta1.Param{{
Header: []pipelinev1.Param{{
Name: "non-canonical-header-key",
Value: v1beta1.ParamValue{
Type: v1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "valid value",
},
}},
Expand Down Expand Up @@ -827,10 +826,10 @@ func TestEventListenerValidate_error(t *testing.T) {
Template: &v1alpha1.EventListenerTemplate{Ref: ptr.String("tt")},
Interceptors: []*v1alpha1.EventInterceptor{{
Webhook: &v1alpha1.WebhookInterceptor{
Header: []v1beta1.Param{{
Header: []pipelinev1.Param{{
Name: "",
Value: v1beta1.ParamValue{
Type: v1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "valid value",
},
}},
Expand Down Expand Up @@ -858,10 +857,10 @@ func TestEventListenerValidate_error(t *testing.T) {
Template: &v1alpha1.EventListenerTemplate{Ref: ptr.String("tt")},
Interceptors: []*v1alpha1.EventInterceptor{{
Webhook: &v1alpha1.WebhookInterceptor{
Header: []v1beta1.Param{{
Header: []pipelinev1.Param{{
Name: "Valid-Header-Key",
Value: v1beta1.ParamValue{
Type: v1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "",
},
}},
Expand Down
34 changes: 17 additions & 17 deletions pkg/apis/triggers/v1alpha1/trigger_template_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"
"testing"

pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1"
"github.com/tektoncd/triggers/test"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -33,7 +33,7 @@ import (
)

func simpleResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
Expand All @@ -42,7 +42,7 @@ func simpleResourceTemplate(t *testing.T) runtime.RawExtension {
}

func v1beta1ResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
Expand All @@ -51,17 +51,17 @@ func v1beta1ResourceTemplate(t *testing.T) runtime.RawExtension {
}

func paramResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
},
Spec: pipelinev1beta1.PipelineRunSpec{
Params: []pipelinev1beta1.Param{
Spec: pipelinev1.PipelineRunSpec{
Params: []pipelinev1.Param{
{
Name: "message",
Value: pipelinev1beta1.ParamValue{
Type: pipelinev1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "$(tt.params.foo)",
},
},
Expand All @@ -71,17 +71,17 @@ func paramResourceTemplate(t *testing.T) runtime.RawExtension {
}

func invalidParamResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
},
Spec: pipelinev1beta1.PipelineRunSpec{
Params: []pipelinev1beta1.Param{
Spec: pipelinev1.PipelineRunSpec{
Params: []pipelinev1.Param{
{
Name: "message",
Value: pipelinev1beta1.ParamValue{
Type: pipelinev1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "$(.foo)",
},
},
Expand Down Expand Up @@ -208,7 +208,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1alpha1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1alpha1",
},
Expand All @@ -234,7 +234,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1alpha1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
Kind: "PipelineRun",
},
Expand All @@ -260,7 +260,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1alpha1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "foobar",
Kind: "pipelinerun",
Expand All @@ -287,7 +287,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1alpha1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "foo",
Kind: "tekton.dev/v1alpha1",
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/triggers/v1alpha1/trigger_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strings"
"testing"

pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
"github.com/tektoncd/triggers/pkg/apis/triggers/v1alpha1"
"github.com/tektoncd/triggers/test"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/triggers/v1beta1/event_listener_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/triggers/pkg/apis/triggers"
triggersv1beta1 "github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1"
Expand Down Expand Up @@ -461,7 +462,7 @@ func Test_EventListenerValidate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []triggersv1beta1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "TaskRun",
Expand Down
34 changes: 17 additions & 17 deletions pkg/apis/triggers/v1beta1/trigger_template_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"context"
"testing"

pipelinev1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1"
pipelinev1alpha1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1"
"github.com/tektoncd/triggers/test"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -33,7 +33,7 @@ import (
)

func simpleResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
Expand All @@ -42,7 +42,7 @@ func simpleResourceTemplate(t *testing.T) runtime.RawExtension {
}

func v1beta1ResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
Expand All @@ -60,17 +60,17 @@ func v1alpha1ResourceTemplate(t *testing.T) runtime.RawExtension {
}

func paramResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
},
Spec: pipelinev1beta1.PipelineRunSpec{
Params: []pipelinev1beta1.Param{
Spec: pipelinev1.PipelineRunSpec{
Params: []pipelinev1.Param{
{
Name: "message",
Value: pipelinev1beta1.ParamValue{
Type: pipelinev1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "$(tt.params.foo)",
},
},
Expand All @@ -80,17 +80,17 @@ func paramResourceTemplate(t *testing.T) runtime.RawExtension {
}

func invalidParamResourceTemplate(t *testing.T) runtime.RawExtension {
return test.RawExtension(t, pipelinev1beta1.PipelineRun{
return test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
Kind: "PipelineRun",
},
Spec: pipelinev1beta1.PipelineRunSpec{
Params: []pipelinev1beta1.Param{
Spec: pipelinev1.PipelineRunSpec{
Params: []pipelinev1.Param{
{
Name: "message",
Value: pipelinev1beta1.ParamValue{
Type: pipelinev1beta1.ParamTypeString,
Value: pipelinev1.ParamValue{
Type: pipelinev1.ParamTypeString,
StringVal: "$(.foo)",
},
},
Expand Down Expand Up @@ -199,7 +199,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1beta1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "tekton.dev/v1beta1",
},
Expand All @@ -225,7 +225,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1beta1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
Kind: "PipelineRun",
},
Expand All @@ -251,7 +251,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1beta1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "foobar",
Kind: "pipelinerun",
Expand All @@ -278,7 +278,7 @@ func TestTriggerTemplate_Validate(t *testing.T) {
Default: ptr.String("val"),
}},
ResourceTemplates: []v1beta1.TriggerResourceTemplate{{
RawExtension: test.RawExtension(t, pipelinev1beta1.PipelineRun{
RawExtension: test.RawExtension(t, pipelinev1.PipelineRun{
TypeMeta: metav1.TypeMeta{
APIVersion: "foo",
Kind: "tekton.dev/v1beta1",
Expand Down
Loading