diff --git a/test/e2e/argo_server_test.go b/test/e2e/argo_server_test.go index 53845847f138..32478fbd46d6 100644 --- a/test/e2e/argo_server_test.go +++ b/test/e2e/argo_server_test.go @@ -592,6 +592,16 @@ func (s *ArgoServerSuite) TestWorkflowService() { Equal("Stopped with strategy 'Terminate'") }) + s.Run("Resubmit", func() { + s.e().PUT("/api/v1/workflows/argo/test/resubmit"). + WithBytes([]byte(`{"memoized": true}`)). + Expect(). + Status(200). + JSON(). + Path("$.metadata.name"). + NotNull() + }) + s.Run("Delete", func() { s.e().DELETE("/api/v1/workflows/argo/test"). Expect(). diff --git a/workflow/controller/operator_test.go b/workflow/controller/operator_test.go index 5dd077e14f5a..479588427967 100644 --- a/workflow/controller/operator_test.go +++ b/workflow/controller/operator_test.go @@ -3977,3 +3977,41 @@ func TestCheckForbiddenErrorAndResbmitAllowed(t *testing.T) { }) } + +func TestResubmitMemoization(t *testing.T) { + wf := unmarshalWF(`apiVersion: argoproj.io/v1alpha1 +kind: Workflow +metadata: + name: my-wf + namespace: argo +spec: + entrypoint: main + templates: + - name: main + container: + image: busybox +status: + phase: Failed + nodes: + my-wf-lzarl: + phase: Failed +`) + wf, err := util.FormulateResubmitWorkflow(wf, true) + if assert.NoError(t, err) { + cancel, controller := newController(wf) + defer cancel() + woc := newWorkflowOperationCtx(wf, controller) + woc.operate() + assert.Equal(t, wfv1.NodePending, woc.wf.Status.Phase) + for _, node := range woc.wf.Status.Nodes { + switch node.TemplateName { + case "main": + assert.Equal(t, wfv1.NodePending, node.Phase) + assert.False(t, node.StartTime().IsZero()) + case "": + default: + assert.Fail(t, "invalid template") + } + } + } +}