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

Prepare tests for impending knative/pkg version bump #5145

Merged
merged 2 commits into from
Jul 21, 2022
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
10 changes: 2 additions & 8 deletions pkg/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fakek8s "k8s.io/client-go/kubernetes/fake"
"knative.dev/pkg/changeset"
logtesting "knative.dev/pkg/logging/testing"
"knative.dev/pkg/system"

Expand All @@ -63,22 +62,17 @@ var (

defaultActiveDeadlineSeconds = int64(config.DefaultTimeoutMinutes * 60 * deadlineFactor)

fakeVersion string

resourceQuantityCmp = cmp.Comparer(func(x, y resource.Quantity) bool {
return x.Cmp(y) == 0
})
volumeSort = cmpopts.SortSlices(func(i, j corev1.Volume) bool { return i.Name < j.Name })
volumeMountSort = cmpopts.SortSlices(func(i, j corev1.VolumeMount) bool { return i.Name < j.Name })
)

const fakeVersion = "a728ce3"

func init() {
os.Setenv("KO_DATA_PATH", "./testdata/")
commit, err := changeset.Get()
if err != nil {
panic(err)
}
fakeVersion = commit
}

func TestPodBuild(t *testing.T) {
Expand Down
9 changes: 2 additions & 7 deletions pkg/reconciler/taskrun/taskrun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ import (
ktesting "k8s.io/client-go/testing"
"k8s.io/client-go/tools/record"
"knative.dev/pkg/apis"
"knative.dev/pkg/changeset"
cminformer "knative.dev/pkg/configmap/informer"
"knative.dev/pkg/controller"
"knative.dev/pkg/kmeta"
Expand Down Expand Up @@ -398,12 +397,13 @@ var (
},
}

fakeVersion string
gitResourceSecurityContext = &corev1.SecurityContext{
RunAsUser: ptr.Int64(0),
}
)

const fakeVersion string = "a728ce3"

func placeToolsInitContainer(steps []string) corev1.Container {
return corev1.Container{
Command: append([]string{"/ko-app/entrypoint", "init", "/ko-app/entrypoint", entrypointLocation}, steps...),
Expand Down Expand Up @@ -442,11 +442,6 @@ func createServiceAccount(t *testing.T, assets test.Assets, name string, namespa

func init() {
os.Setenv("KO_DATA_PATH", "./testdata/")
commit, err := changeset.Get()
if err != nil {
panic(err)
}
fakeVersion = commit
}

func getRunName(tr *v1beta1.TaskRun) string {
Expand Down