From f7fd56db91f1fe1af470e1fd6d564dec2c44d154 Mon Sep 17 00:00:00 2001 From: Jorge Ejarque Date: Mon, 11 Nov 2024 17:31:26 +0100 Subject: [PATCH] Fixing bug when execution with stub and no stub defined (#5473) Signed-off-by: jorgee Signed-off-by: Paolo Di Tommaso Co-authored-by: Paolo Di Tommaso --- .../groovy/nextflow/processor/TaskRun.groovy | 2 +- .../nextflow/processor/TaskRunTest.groovy | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/nextflow/src/main/groovy/nextflow/processor/TaskRun.groovy b/modules/nextflow/src/main/groovy/nextflow/processor/TaskRun.groovy index f3926c0b60..38b4ba4782 100644 --- a/modules/nextflow/src/main/groovy/nextflow/processor/TaskRun.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/processor/TaskRun.groovy @@ -790,7 +790,7 @@ class TaskRun implements Cloneable { * @param body A {@code BodyDef} object instance */ void resolve(BodyDef body) { - processor.session.stubRun + processor.session.stubRun && config.getStubBlock() ? resolveStub(config.getStubBlock()) : resolveBody(body) } diff --git a/modules/nextflow/src/test/groovy/nextflow/processor/TaskRunTest.groovy b/modules/nextflow/src/test/groovy/nextflow/processor/TaskRunTest.groovy index 9ea25d7db8..6f1e988899 100644 --- a/modules/nextflow/src/test/groovy/nextflow/processor/TaskRunTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/processor/TaskRunTest.groovy @@ -907,6 +907,23 @@ class TaskRunTest extends Specification { 0 * task.resolveStub(_) >> null } + def 'should resolve task body when no stub' () { + given: + def task = Spy(TaskRun) + task.processor = Mock(TaskProcessor) { + getSession()>>Mock(Session) { getStubRun() >> true} + } + task.config = Mock(TaskConfig) { getStubBlock()>> null } + and: + def body = Mock(BodyDef) + + when: + task.resolve(body) + then: + 1 * task.resolveBody(body) >> null + 0 * task.resolveStub(_) >> null + } + def 'should resolve task stub' () { given: def body = Mock(BodyDef)