Skip to content

Commit 89f69bc

Browse files
committed
fix: add session config to test mocks to prevent NPE
- PackageManager.isEnabled() requires session.config to be non-null - Added config >> [:] to Session mocks in affected tests - Fixes CondorExecutorTest and CrgExecutorTest failures
1 parent 83f4e97 commit 89f69bc

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

modules/nextflow/src/test/groovy/nextflow/executor/CondorExecutorTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ class CondorExecutorTest extends Specification {
231231
given:
232232
def session = Mock(Session)
233233
session.getContainerConfig() >> new DockerConfig(enabled:false)
234+
session.config >> [:]
234235
def folder = Files.createTempDirectory('test')
235236
def executor = [:] as CondorExecutor
236237
def task = new TaskRun(name: 'Hello', workDir: folder, script: 'echo Hello world!')

modules/nextflow/src/test/groovy/nextflow/executor/CrgExecutorTest.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ class CrgExecutorTest extends Specification {
484484
task.processor = Mock(TaskProcessor)
485485
task.processor.getSession() >> Mock(Session) {
486486
getContainerConfig() >> new DockerConfig([:])
487+
config >> [:]
487488
}
488489
task.processor.getProcessEnvironment() >> [:]
489490
task.processor.getConfig() >> [:]
@@ -511,6 +512,7 @@ class CrgExecutorTest extends Specification {
511512
given:
512513
def sess = Mock(Session) {
513514
getContainerConfig(null) >> new DockerConfig(enabled: true)
515+
config >> [:]
514516
}
515517
and:
516518
def executor = Spy(new CrgExecutor(session: sess)) { isContainerNative()>>false }
@@ -550,6 +552,7 @@ class CrgExecutorTest extends Specification {
550552
given:
551553
def sess = Mock(Session) {
552554
getContainerConfig(null) >> new DockerConfig(enabled: true, legacy:true)
555+
config >> [:]
553556
}
554557
and:
555558
def executor = Spy(new CrgExecutor(session: sess)) { isContainerNative()>>false }

0 commit comments

Comments
 (0)