Skip to content

Commit

Permalink
Fixing bug when execution with stub and no stub defined (#5473)
Browse files Browse the repository at this point in the history

Signed-off-by: jorgee <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
jorgee and pditommaso authored Nov 11, 2024
1 parent eaaeb3d commit f7fd56d
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()>> 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)
Expand Down

0 comments on commit f7fd56d

Please sign in to comment.