Skip to content

Commit

Permalink
Fixing bug when execution with stub and no stub defined
Browse files Browse the repository at this point in the history
Signed-off-by: jorgee <[email protected]>
  • Loading branch information
jorgee committed Nov 5, 2024
1 parent 549e790 commit f10fb20
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()>> :wqnull }
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)
Expand Down

0 comments on commit f10fb20

Please sign in to comment.