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: mark test as integration test #1920

Merged
merged 1 commit into from
Aug 9, 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
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

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
Loading