Skip to content

Commit

Permalink
Actually move pkg/merge into pkg/apis/pipeline/v1alpha1/ to avoid cir…
Browse files Browse the repository at this point in the history
…cular dependency
  • Loading branch information
imjasonh committed Jul 10, 2019
1 parent 3b67f74 commit f34f993
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{
Expand All @@ -71,7 +78,7 @@ func TestCombineStepsWithStepTemplate(t *testing.T) {
},
},
},
steps: []corev1.Container{{
steps: []Step{{Container: corev1.Container{
Env: []corev1.EnvVar{
{
Name: "NEW_KEY",
Expand All @@ -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",
Expand All @@ -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)
Expand All @@ -109,4 +116,3 @@ func TestCombineStepsWithStepTemplate(t *testing.T) {
})
}
}
*/
14 changes: 0 additions & 14 deletions pkg/merge/merge.go

This file was deleted.

0 comments on commit f34f993

Please sign in to comment.