Skip to content

Commit

Permalink
fix(executor): Fix emissary resource template bug (argoproj#5295)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Mar 4, 2021
1 parent 288ab92 commit 1a8ce1f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/e2e/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ func (s *CLISuite) TestResourceTemplateStopAndTerminate() {
RunCli([]string{"submit", "functional/resource-template.yaml", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Pending")
}).
WaitForWorkflow(fixtures.ToBeRunning).
WaitForWorkflow(fixtures.ToHaveRunningPod).
RunCli([]string{"get", "resource-tmpl-wf"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Running")
}).
Expand All @@ -1290,7 +1290,7 @@ func (s *CLISuite) TestResourceTemplateStopAndTerminate() {
RunCli([]string{"submit", "functional/resource-template.yaml", "--name", "resource-tmpl-wf-1", "-l", "workflows.argoproj.io/test=true"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Pending")
}).
WaitForWorkflow(fixtures.ToBeRunning).
WaitForWorkflow(fixtures.ToHaveRunningPod).
RunCli([]string{"get", "resource-tmpl-wf-1"}, func(t *testing.T, output string, err error) {
assert.Contains(t, output, "Running")
}).
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixtures/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func printWorkflow(wf *wfv1.Workflow) {
println(fmt.Sprintf("%-20s %s", "Name:", wf.Name))
println(fmt.Sprintf("%-18s %v %s", "Phase:", workflowPhaseIcon[wf.Status.Phase], wf.Status.Phase))
println(fmt.Sprintf("%-20s %s", "Message:", wf.Status.Message))
println(fmt.Sprintf("%-20s %s", "Duration:", time.Since(wf.Status.StartedAt.Time).Truncate(time.Second)))
println(fmt.Sprintf("%-20s %s", "Duration:", wf.Status.GetDuration()))
println()

w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/fixtures/when.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ var (
ToBeCompleted Condition = func(wf *wfv1.Workflow) (bool, string) {
return wf.Labels[common.LabelKeyCompleted] == "true", "to be completed"
}
ToStart Condition = func(wf *wfv1.Workflow) (bool, string) { return !wf.Status.StartedAt.IsZero(), "to start" }
ToBeRunning Condition = func(wf *wfv1.Workflow) (bool, string) {
ToStart Condition = func(wf *wfv1.Workflow) (bool, string) { return !wf.Status.StartedAt.IsZero(), "to start" }
ToHaveRunningPod Condition = func(wf *wfv1.Workflow) (bool, string) {
return wf.Status.Nodes.Any(func(node wfv1.NodeStatus) bool {
return node.Phase == wfv1.NodeRunning
}), "to be running"
return node.Type == wfv1.NodeTypePod && node.Phase == wfv1.NodeRunning
}), "to have running pod"
}
)

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (s *FunctionalSuite) TestDeletingRunningPodWithOrErrorRetryPolicy() {
s.Given().
Workflow("@testdata/sleepy-retry-on-error-workflow.yaml").
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToBeRunning).
SubmitWorkflow(). // TODO
WaitForWorkflow(fixtures.ToHaveRunningPod).
Exec("kubectl", []string{"-n", "argo", "delete", "pod", "-l", "workflows.argoproj.io/workflow"}, fixtures.NoError).
WaitForWorkflow().
Then().
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/signals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s *SignalsSuite) TestStopBehavior() {
Workflow("@functional/stop-terminate.yaml").
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToStart).
WaitForWorkflow(fixtures.ToHaveRunningPod).
RunCli([]string{"stop", "@latest"}, func(t *testing.T, output string, err error) {
assert.NoError(t, err)
assert.Regexp(t, "workflow stop-terminate-.* stopped", output)
Expand Down Expand Up @@ -61,7 +61,7 @@ func (s *SignalsSuite) TestTerminateBehavior() {
Workflow("@functional/stop-terminate.yaml").
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToStart).
WaitForWorkflow(fixtures.ToHaveRunningPod).
RunCli([]string{"terminate", "@latest"}, func(t *testing.T, output string, err error) {
assert.NoError(t, err)
assert.Regexp(t, "workflow stop-terminate-.* terminated", output)
Expand All @@ -87,7 +87,7 @@ func (s *SignalsSuite) TestDoNotCreatePodsUnderStopBehavior() {
Workflow("@functional/stop-terminate-2.yaml").
When().
SubmitWorkflow().
WaitForWorkflow(fixtures.ToStart).
WaitForWorkflow(fixtures.ToHaveRunningPod).
RunCli([]string{"stop", "@latest"}, func(t *testing.T, output string, err error) {
assert.NoError(t, err)
assert.Regexp(t, "workflow stop-terminate-.* stopped", output)
Expand Down
2 changes: 1 addition & 1 deletion workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
addSidecars(pod, tmpl)
addOutputArtifactsVolumes(pod, tmpl)

if woc.getContainerRuntimeExecutor() == common.ContainerRuntimeExecutorEmissary && tmpl.GetType() != wfv1.TemplateTypeResource {
if woc.getContainerRuntimeExecutor() == common.ContainerRuntimeExecutorEmissary {
for i, c := range pod.Spec.InitContainers {
c.VolumeMounts = append(c.VolumeMounts, volumeMountVarArgo)
pod.Spec.InitContainers[i] = c
Expand Down

0 comments on commit 1a8ce1f

Please sign in to comment.