Skip to content

Commit

Permalink
chore: mark test as integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Matej Vasek <[email protected]>
  • Loading branch information
matejvasek committed Aug 9, 2023
1 parent 20a4eb2 commit ee10767
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 31 deletions.
44 changes: 44 additions & 0 deletions pkg/pipelines/tekton/templates_integration_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//go:build integration

Check failure on line 1 in pkg/pipelines/tekton/templates_integration_test.go

View workflow job for this annotation

GitHub Actions / style / Golang / Auto-format and Check

Please run goimports. diff --git a/pkg/pipelines/tekton/templates_integration_test.go b/pkg/pipelines/tekton/templates_integration_test.go index 64371a2..ea6129a 100644 --- a/pkg/pipelines/tekton/templates_integration_test.go +++ b/pkg/pipelines/tekton/templates_integration_test.go @@ -7,7 +7,7 @@ import ( "github.com/manifestival/manifestival" "github.com/manifestival/manifestival/fake" - + fn "knative.dev/func/pkg/functions" . "knative.dev/func/pkg/testing" )

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)
}
})
}
}
31 changes: 0 additions & 31 deletions pkg/pipelines/tekton/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ee10767

Please sign in to comment.