From bff156cbe615a7be613e715fd1486e60250f6574 Mon Sep 17 00:00:00 2001 From: FogDong Date: Fri, 21 Jan 2022 11:55:08 +0800 Subject: [PATCH] fix ut Signed-off-by: FogDong --- .../v1alpha2/application/application_controller.go | 2 -- pkg/workflow/workflow.go | 2 ++ pkg/workflow/workflow_test.go | 9 --------- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/pkg/controller/core.oam.dev/v1alpha2/application/application_controller.go b/pkg/controller/core.oam.dev/v1alpha2/application/application_controller.go index 096e18fbe..2759e5191 100644 --- a/pkg/controller/core.oam.dev/v1alpha2/application/application_controller.go +++ b/pkg/controller/core.oam.dev/v1alpha2/application/application_controller.go @@ -375,8 +375,6 @@ func (r *Reconciler) handleFinalizers(ctx monitorContext.Context, app *v1beta1.A if wfContext.EnableInMemoryContext { wfContext.MemStore.DeleteInMemoryContext(app.Name) } - workflow.StepStatusCache.Delete(fmt.Sprintf("%s-%s", app.Name, app.Namespace)) - wfContext.CleanupMemoryStore(app.Name, app.Namespace) return true, result, err } } diff --git a/pkg/workflow/workflow.go b/pkg/workflow/workflow.go index eb438c69e..9f337dd27 100644 --- a/pkg/workflow/workflow.go +++ b/pkg/workflow/workflow.go @@ -124,6 +124,8 @@ func (w *workflow) ExecuteSteps(ctx monitorContext.Context, appRev *oamcore.Appl } } w.app.Status.Conditions = reservedConditions + StepStatusCache.Delete(fmt.Sprintf("%s-%s", w.app.Name, w.app.Namespace)) + wfContext.CleanupMemoryStore(w.app.Name, w.app.Namespace) return common.WorkflowStateInitializing, nil } diff --git a/pkg/workflow/workflow_test.go b/pkg/workflow/workflow_test.go index 8cb2247d7..810a7f41c 100644 --- a/pkg/workflow/workflow_test.go +++ b/pkg/workflow/workflow_test.go @@ -142,7 +142,6 @@ var _ = Describe("Test Workflow", func() { Phase: common.WorkflowStepPhaseSucceeded, }}, })).Should(BeEquivalentTo("")) - }) It("Workflow test for failed after retries", func() { @@ -237,7 +236,6 @@ var _ = Describe("Test Workflow", func() { Phase: common.WorkflowStepPhaseSucceeded, }}, })).Should(BeEquivalentTo("")) - }) It("Test get backoff time and clean", func() { @@ -249,15 +247,8 @@ var _ = Describe("Test Workflow", func() { }) ctx := monitorContext.NewTraceContext(context.Background(), "test-app") wf := NewWorkflow(app, k8sClient, common.WorkflowModeDAG) - StepStatusCache.Store("app-default", 1) _, err := wf.ExecuteSteps(ctx, revision, runners) Expect(err).ToNot(HaveOccurred()) - app.Status.Workflow.Steps = []common.WorkflowStepStatus{ - { - ID: "test-step-id", - Phase: common.WorkflowStepPhaseRunning, - }, - } _, err = wf.ExecuteSteps(ctx, revision, runners) Expect(err).ToNot(HaveOccurred()) wfCtx, err := wfContext.LoadContext(k8sClient, app.Namespace, app.Name)