From f34f993323f861bbcf762e1e21502f0e9e5e2516 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Tue, 9 Jul 2019 21:52:51 -0400 Subject: [PATCH] Actually move pkg/merge into pkg/apis/pipeline/v1alpha1/ to avoid circular dependency --- .../pipeline/v1alpha1}/merge_test.go | 48 +++++++++++-------- pkg/merge/merge.go | 14 ------ 2 files changed, 27 insertions(+), 35 deletions(-) rename pkg/{merge => apis/pipeline/v1alpha1}/merge_test.go (78%) delete mode 100644 pkg/merge/merge.go diff --git a/pkg/merge/merge_test.go b/pkg/apis/pipeline/v1alpha1/merge_test.go similarity index 78% rename from pkg/merge/merge_test.go rename to pkg/apis/pipeline/v1alpha1/merge_test.go index 45dfbb680c6..c6ae23eebda 100644 --- a/pkg/merge/merge_test.go +++ b/pkg/apis/pipeline/v1alpha1/merge_test.go @@ -11,9 +11,16 @@ limitations under the License. */ -package merge +package v1alpha1 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" +) -/* func TestCombineStepsWithStepTemplate(t *testing.T) { resourceQuantityCmp := cmp.Comparer(func(x, y resource.Quantity) bool { return x.Cmp(y) == 0 @@ -22,42 +29,42 @@ func TestCombineStepsWithStepTemplate(t *testing.T) { for _, tc := range []struct { name string template *corev1.Container - steps []corev1.Container - expected []corev1.Container + steps []Step + expected []Step }{{ name: "nil-template", template: nil, - steps: []corev1.Container{{ + steps: []Step{{Container: corev1.Container{ Image: "some-image", - }}, - expected: []corev1.Container{{ + }}}, + expected: []Step{{Container: corev1.Container{ Image: "some-image", - }}, + }}}, }, { name: "not-overlapping", template: &corev1.Container{ Command: []string{"/somecmd"}, }, - steps: []corev1.Container{{ + steps: []Step{{Container: corev1.Container{ Image: "some-image", - }}, - expected: []corev1.Container{{ + }}}, + expected: []Step{{Container: corev1.Container{ Command: []string{"/somecmd"}, Image: "some-image", - }}, + }}}, }, { name: "overwriting-one-field", template: &corev1.Container{ Image: "some-image", Command: []string{"/somecmd"}, }, - steps: []corev1.Container{{ + steps: []Step{{Container: corev1.Container{ Image: "some-other-image", - }}, - expected: []corev1.Container{{ + }}}, + expected: []Step{{Container: corev1.Container{ Command: []string{"/somecmd"}, Image: "some-other-image", - }}, + }}}, }, { name: "merge-and-overwrite-slice", template: &corev1.Container{ @@ -71,7 +78,7 @@ func TestCombineStepsWithStepTemplate(t *testing.T) { }, }, }, - steps: []corev1.Container{{ + steps: []Step{{Container: corev1.Container{ Env: []corev1.EnvVar{ { Name: "NEW_KEY", @@ -81,8 +88,8 @@ func TestCombineStepsWithStepTemplate(t *testing.T) { Value: "NEW_VALUE", }, }, - }}, - expected: []corev1.Container{{ + }}}, + expected: []Step{{Container: corev1.Container{ Env: []corev1.EnvVar{ { Name: "NEW_KEY", @@ -95,7 +102,7 @@ func TestCombineStepsWithStepTemplate(t *testing.T) { Value: "NEW_VALUE", }, }, - }}, + }}}, }} { t.Run(tc.name, func(t *testing.T) { result, err := CombineStepsWithStepTemplate(tc.template, tc.steps) @@ -109,4 +116,3 @@ func TestCombineStepsWithStepTemplate(t *testing.T) { }) } } -*/ diff --git a/pkg/merge/merge.go b/pkg/merge/merge.go deleted file mode 100644 index a96a33d4f43..00000000000 --- a/pkg/merge/merge.go +++ /dev/null @@ -1,14 +0,0 @@ -/* - Copyright 2019 Knative Authors LLC - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package merge