From 27b697eca942e15313d5e20d2ceaa704198bdbc0 Mon Sep 17 00:00:00 2001 From: Susmitha <95962296+SusmithaGU@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:18:40 +0530 Subject: [PATCH] fix(orca): tying exceptions to tasks (#4517) * fix(orca): tying exceptions to tasks * fix(orca): added test separately --- .../netflix/spinnaker/orca/q/handler/RunTaskHandler.kt | 2 ++ .../spinnaker/orca/q/handler/RunTaskHandlerTest.kt | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandler.kt b/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandler.kt index 436c3e2873..330394b51c 100644 --- a/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandler.kt +++ b/orca-queue/src/main/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandler.kt @@ -228,6 +228,8 @@ class RunTaskHandler( } val status = stage.failureStatus(default = TERMINAL) stage.context["exception"] = exceptionDetails + //Adding here serves two purposes one to display taskwise failures,other to display the exact failure when continue pipeline is set to true + taskModel.taskExceptionDetails["exception"] = exceptionDetails repository.storeStage(stage) queue.push(CompleteTask(message, status, TERMINAL)) trackResult(stage, thisInvocationStartTimeMs, taskModel, status) diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandlerTest.kt index 23953f0481..1412feee74 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/RunTaskHandlerTest.kt @@ -583,6 +583,14 @@ object RunTaskHandlerTest : SubjectSpek({ } ) } + + it("attaches the exception to the taskExceptionDetails") { + verify(repository).storeStage( + check { + assertThat(it.tasks[0].taskExceptionDetails["exception"]).isEqualTo(exceptionDetails) + } + ) + } } and("the task should not fail the whole pipeline, only the branch") {