Skip to content

Commit

Permalink
fix(test): TestWorkflowTemplateRefWithShutdownAndSuspend flakiness (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sarabala1979 authored Mar 18, 2021
1 parent c16a471 commit 07ef0e6
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions workflow/controller/operator_workflow_template_ref_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,12 @@ func TestWorkflowTemplateRefGetArtifactsFromTemplate(t *testing.T) {
}

func TestWorkflowTemplateRefWithShutdownAndSuspend(t *testing.T) {
cancel, controller := newController(unmarshalWF(wfWithTmplRef), unmarshalWFTmpl(wfTmpl))
defer cancel()
t.Run("EntrypointMissingInStoredWfSpec", func(t *testing.T) {
t.Run("EntryPointMissingInStoredWfSpec", func(t *testing.T) {
wf := unmarshalWF(wfWithTmplRef)
cancel, controller := newController(wf, unmarshalWFTmpl(wfTmpl))
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(unmarshalWF(wfWithTmplRef), controller)
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Nil(t, woc.wf.Status.StoredWorkflowSpec.Suspend)
wf1 := woc.wf.DeepCopy()
Expand All @@ -305,8 +306,11 @@ func TestWorkflowTemplateRefWithShutdownAndSuspend(t *testing.T) {
})

t.Run("WorkflowTemplateRefWithSuspend", func(t *testing.T) {
wf := unmarshalWF(wfWithTmplRef)
cancel, controller := newController(wf, unmarshalWFTmpl(wfTmpl))
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(unmarshalWF(wfWithTmplRef), controller)
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Nil(t, woc.wf.Status.StoredWorkflowSpec.Suspend)
wf1 := woc.wf.DeepCopy()
Expand All @@ -319,8 +323,11 @@ func TestWorkflowTemplateRefWithShutdownAndSuspend(t *testing.T) {
assert.True(t, *woc1.wf.Status.StoredWorkflowSpec.Suspend)
})
t.Run("WorkflowTemplateRefWithShutdownTerminate", func(t *testing.T) {
wf := unmarshalWF(wfWithTmplRef)
cancel, controller := newController(wf, unmarshalWFTmpl(wfTmpl))
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(unmarshalWF(wfWithTmplRef), controller)
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Empty(t, woc.wf.Status.StoredWorkflowSpec.Shutdown)
wf1 := woc.wf.DeepCopy()
Expand All @@ -339,8 +346,11 @@ func TestWorkflowTemplateRefWithShutdownAndSuspend(t *testing.T) {
}
})
t.Run("WorkflowTemplateRefWithShutdownStop", func(t *testing.T) {
wf := unmarshalWF(wfWithTmplRef)
cancel, controller := newController(wf, unmarshalWFTmpl(wfTmpl))
defer cancel()
ctx := context.Background()
woc := newWorkflowOperationCtx(unmarshalWF(wfWithTmplRef), controller)
woc := newWorkflowOperationCtx(wf, controller)
woc.operate(ctx)
assert.Empty(t, woc.wf.Status.StoredWorkflowSpec.Shutdown)
wf1 := woc.wf.DeepCopy()
Expand Down

0 comments on commit 07ef0e6

Please sign in to comment.