Skip to content

Commit

Permalink
Address review comments from #1653
Browse files Browse the repository at this point in the history
Adds tests for script preservation and args alongside scripts
  • Loading branch information
imjasonh authored and tekton-robot committed Dec 3, 2019
1 parent 610c7a5 commit 7cecdeb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/apis/pipeline/v1alpha1/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,28 @@ func TestMergeStepsWithStepTemplate(t *testing.T) {
Value: "NEW_VALUE",
}},
}}},
}, {
name: "merge-preserves-script",
template: &corev1.Container{
Env: []corev1.EnvVar{{
Name: "FOO",
Value: "bar",
}},
},
steps: []Step{{
Script: "my-script",
Container: corev1.Container{Image: "image"},
}},
expected: []Step{{
Script: "my-script",
Container: corev1.Container{
Image: "image",
Env: []corev1.EnvVar{{
Name: "FOO",
Value: "bar",
}},
},
}},
}} {
t.Run(tc.name, func(t *testing.T) {
result, err := MergeStepsWithStepTemplate(tc.template, tc.steps)
Expand Down
2 changes: 2 additions & 0 deletions pkg/pod/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func TestConvertScripts(t *testing.T) {
Container: corev1.Container{
Image: "step-3",
VolumeMounts: preExistingVolumeMounts,
Args: []string{"my", "args"},
},
}})
wantInit := &corev1.Container{
Expand Down Expand Up @@ -95,6 +96,7 @@ script-heredoc-randomly-generated-6nl7g
}, {
Image: "step-3",
Command: []string{"/tekton/scripts/script-2-78c5n"},
Args: []string{"my", "args"},
VolumeMounts: append(preExistingVolumeMounts, scriptsVolumeMount),
}}
if d := cmp.Diff(wantInit, gotInit); d != "" {
Expand Down

0 comments on commit 7cecdeb

Please sign in to comment.