Skip to content

Commit

Permalink
manual formatting since gofmt didn't do anything?
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Gilgur <[email protected]>
  • Loading branch information
Anton Gilgur committed Oct 28, 2024
1 parent 319fd19 commit 26ff9c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion workflow/controller/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3433,7 +3433,8 @@ func TestResolveIOPathPlaceholders(t *testing.T) {
assert.NotEmpty(t, pods.Items, "pod was not created successfully")

assert.Equal(t, append(append([]string{"/var/run/argo/argoexec", "emissary"}, woc.getExecutorLogOpts()...),
"--", "sh", "-c", "head -n 3 <\"/inputs/text/data\" | tee \"/outputs/text/data\" | wc -l > \"/outputs/actual-lines-count/data\""), pods.Items[0].Spec.Containers[1].Command)
"--", "sh", "-c", "head -n 3 <\"/inputs/text/data\" | tee \"/outputs/text/data\" | wc -l > \"/outputs/actual-lines-count/data\"",
), pods.Items[0].Spec.Containers[1].Command)
}

var outputValuePlaceholders = `
Expand Down
3 changes: 2 additions & 1 deletion workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
c.Args = x.Cmd
}
}
c.Command = append(append(append([]string{common.VarRunArgoPath + "/argoexec", "emissary"}, woc.getExecutorLogOpts()...), "--"), c.Command...)
execCmd := append(append([]string{common.VarRunArgoPath + "/argoexec", "emissary"}, woc.getExecutorLogOpts()...), "--")
c.Command = append(execCmd, c.Command...)
}
if c.Image == woc.controller.executorImage() {
// mount tmp dir to wait container
Expand Down
15 changes: 10 additions & 5 deletions workflow/controller/workflowpod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,20 +660,23 @@ func Test_createWorkflowPod_emissary(t *testing.T) {
woc := newWoc()
pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Command: []string{"foo"}}}, &wfv1.Template{}, &createWorkflowPodOpts{})
require.NoError(t, err)
assert.Equal(t, append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "foo"), pod.Spec.Containers[1].Command)
cmd := append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "foo")
assert.Equal(t, cmd, pod.Spec.Containers[1].Command)
})
t.Run("NoCommandWithImageIndex", func(t *testing.T) {
woc := newWoc()
pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Image: "my-image"}}, &wfv1.Template{}, &createWorkflowPodOpts{})
require.NoError(t, err)
assert.Equal(t, append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "my-entrypoint"), pod.Spec.Containers[1].Command)
cmd := append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "my-entrypoint")
assert.Equal(t, cmd, pod.Spec.Containers[1].Command)
assert.Equal(t, []string{"my-cmd"}, pod.Spec.Containers[1].Args)
})
t.Run("NoCommandWithArgsWithImageIndex", func(t *testing.T) {
woc := newWoc()
pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Image: "my-image", Args: []string{"foo"}}}, &wfv1.Template{}, &createWorkflowPodOpts{})
require.NoError(t, err)
assert.Equal(t, append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "my-entrypoint"), pod.Spec.Containers[1].Command)
cmd := append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "my-entrypoint")
assert.Equal(t, cmd, pod.Spec.Containers[1].Command)
assert.Equal(t, []string{"foo"}, pod.Spec.Containers[1].Args)
})
t.Run("CommandFromPodSpecPatch", func(t *testing.T) {
Expand All @@ -687,7 +690,8 @@ func Test_createWorkflowPod_emissary(t *testing.T) {
require.NoError(t, err)
pod, err := woc.createWorkflowPod(context.Background(), "", []apiv1.Container{{Command: []string{"foo"}}}, &wfv1.Template{PodSpecPatch: string(podSpecPatch)}, &createWorkflowPodOpts{})
require.NoError(t, err)
assert.Equal(t, append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "bar"), pod.Spec.Containers[1].Command)
cmd := append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "bar")
assert.Equal(t, cmd, pod.Spec.Containers[1].Command)
})
}

Expand Down Expand Up @@ -741,7 +745,8 @@ func TestVolumeAndVolumeMounts(t *testing.T) {
assert.Equal(t, "tmp-dir-argo", wait.VolumeMounts[1].Name)
assert.Equal(t, "var-run-argo", wait.VolumeMounts[2].Name)
main := containers[1]
assert.Equal(t, append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "cowsay"), main.Command)
cmd := append(append(emissaryCmd, woc.getExecutorLogOpts()...), "--", "cowsay")
assert.Equal(t, cmd, main.Command)
require.Len(t, main.VolumeMounts, 2)
assert.Equal(t, "volume-name", main.VolumeMounts[0].Name)
assert.Equal(t, "var-run-argo", main.VolumeMounts[1].Name)
Expand Down

0 comments on commit 26ff9c6

Please sign in to comment.