diff --git a/pkg/pipelines/tekton/templates_integration_test.go b/pkg/pipelines/tekton/templates_integration_test.go new file mode 100644 index 0000000000..ea6129adf8 --- /dev/null +++ b/pkg/pipelines/tekton/templates_integration_test.go @@ -0,0 +1,44 @@ +//go:build integration + +package tekton + +import ( + "testing" + + "github.com/manifestival/manifestival" + "github.com/manifestival/manifestival/fake" + + fn "knative.dev/func/pkg/functions" + . "knative.dev/func/pkg/testing" +) + +func Test_createAndApplyPipelineTemplate(t *testing.T) { + for _, tt := range testData { + t.Run(tt.name, func(t *testing.T) { + // save current function and restore it at the end + old := manifestivalClient + defer func() { manifestivalClient = old }() + + manifestivalClient = func() (manifestival.Client, error) { + return fake.New(), nil + } + + root := tt.root + defer Using(t, root)() + + f, err := fn.NewFunction(root) + if err != nil { + t.Fatal(err) + } + + f.Build.Builder = tt.builder + f.Runtime = tt.runtime + f.Image = "docker.io/alice/" + f.Name + f.Registry = TestRegistry + + if err := createAndApplyPipelineTemplate(f, tt.namespace, tt.labels); (err != nil) != tt.wantErr { + t.Errorf("createAndApplyPipelineTemplate() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/pkg/pipelines/tekton/templates_test.go b/pkg/pipelines/tekton/templates_test.go index 1ce07f3892..4fbc5e2863 100644 --- a/pkg/pipelines/tekton/templates_test.go +++ b/pkg/pipelines/tekton/templates_test.go @@ -267,37 +267,6 @@ var testData = []struct { }, } -func Test_createAndApplyPipelineTemplate(t *testing.T) { - for _, tt := range testData { - t.Run(tt.name, func(t *testing.T) { - // save current function and restore it at the end - old := manifestivalClient - defer func() { manifestivalClient = old }() - - manifestivalClient = func() (manifestival.Client, error) { - return fake.New(), nil - } - - root := tt.root - defer Using(t, root)() - - f, err := fn.NewFunction(root) - if err != nil { - t.Fatal(err) - } - - f.Build.Builder = tt.builder - f.Runtime = tt.runtime - f.Image = "docker.io/alice/" + f.Name - f.Registry = TestRegistry - - if err := createAndApplyPipelineTemplate(f, tt.namespace, tt.labels); (err != nil) != tt.wantErr { - t.Errorf("createAndApplyPipelineTemplate() error = %v, wantErr %v", err, tt.wantErr) - } - }) - } -} - func Test_createAndApplyPipelineRunTemplate(t *testing.T) { for _, tt := range testData { t.Run(tt.name, func(t *testing.T) {