From 19c1d7bd404388753c777a05adf6326b0435c3ed Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:45:39 +0530 Subject: [PATCH 1/2] Pass complete workflow as input to failure workflow. --- .../com/netflix/conductor/core/execution/WorkflowExecutor.java | 1 + .../netflix/conductor/core/execution/TestWorkflowExecutor.java | 3 +++ .../conductor/test/integration/FailureWorkflowSpec.groovy | 2 ++ 3 files changed, 6 insertions(+) diff --git a/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java b/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java index 240c890308..a84ade3936 100644 --- a/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java +++ b/core/src/main/java/com/netflix/conductor/core/execution/WorkflowExecutor.java @@ -651,6 +651,7 @@ public WorkflowModel terminateWorkflow( if (workflow.getFailedTaskId() != null) { input.put("failureTaskId", workflow.getFailedTaskId()); } + input.put("failedWorkflow", workflow); try { String failureWFId = idGenerator.generate(); diff --git a/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java b/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java index 691a24bc64..77225515e5 100644 --- a/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java +++ b/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java @@ -2101,6 +2101,9 @@ public void testTerminateWorkflowWithFailureWorkflow() { workflow.getWorkflowId(), startWorkflowInput.getWorkflowInput().get("workflowId")); assertEquals( failedTask.getTaskId(), startWorkflowInput.getWorkflowInput().get("failureTaskId")); + assertNotNull( + failedTask.getTaskId(), + argumentCaptor.getAllValues().get(0).getInput().get("failedWorkflow")); } @Test diff --git a/test-harness/src/test/groovy/com/netflix/conductor/test/integration/FailureWorkflowSpec.groovy b/test-harness/src/test/groovy/com/netflix/conductor/test/integration/FailureWorkflowSpec.groovy index 63bf1d829c..c5168ef702 100644 --- a/test-harness/src/test/groovy/com/netflix/conductor/test/integration/FailureWorkflowSpec.groovy +++ b/test-harness/src/test/groovy/com/netflix/conductor/test/integration/FailureWorkflowSpec.groovy @@ -73,6 +73,7 @@ class FailureWorkflowSpec extends AbstractSpecification { input['failureTaskId'] == workflowFailureTaskId tasks.size() == 1 tasks[0].taskType == 'LAMBDA' + input['failedWorkflow'] != null } } } @@ -140,6 +141,7 @@ class FailureWorkflowSpec extends AbstractSpecification { input['failureTaskId'] == workflowFailureTaskId tasks.size() == 1 tasks[0].taskType == 'LAMBDA' + input['failedWorkflow'] != null } } } From 0a180ac4cf8c7eb06766084956e959499f880195 Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Wed, 12 Apr 2023 18:49:08 +0530 Subject: [PATCH 2/2] test fix --- .../netflix/conductor/core/execution/TestWorkflowExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java b/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java index 77225515e5..9f60f49111 100644 --- a/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java +++ b/core/src/test/java/com/netflix/conductor/core/execution/TestWorkflowExecutor.java @@ -2103,7 +2103,7 @@ public void testTerminateWorkflowWithFailureWorkflow() { failedTask.getTaskId(), startWorkflowInput.getWorkflowInput().get("failureTaskId")); assertNotNull( failedTask.getTaskId(), - argumentCaptor.getAllValues().get(0).getInput().get("failedWorkflow")); + startWorkflowInput.getWorkflowInput().get("failedWorkflow")); } @Test