diff --git a/modules/nextflow/src/main/groovy/nextflow/container/ApptainerConfig.groovy b/modules/nextflow/src/main/groovy/nextflow/container/ApptainerConfig.groovy index 4bb967b2f4..44eb82fa19 100644 --- a/modules/nextflow/src/main/groovy/nextflow/container/ApptainerConfig.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/container/ApptainerConfig.groovy @@ -107,7 +107,7 @@ class ApptainerConfig implements ConfigScope, ContainerConfig { libraryDir = opts.libraryDir noHttps = opts.noHttps as boolean ociAutoPull = opts.ociAutoPull as boolean - pullTimeout = opts.pullTimeout as Duration + pullTimeout = opts.pullTimeout as Duration ?: Duration.of('20min') registry = opts.registry runOptions = opts.runOptions } diff --git a/modules/nextflow/src/test/groovy/nextflow/container/ApptainerConfigTest.groovy b/modules/nextflow/src/test/groovy/nextflow/container/ApptainerConfigTest.groovy new file mode 100644 index 0000000000..b8847e42b2 --- /dev/null +++ b/modules/nextflow/src/test/groovy/nextflow/container/ApptainerConfigTest.groovy @@ -0,0 +1,53 @@ +package nextflow.container + +import nextflow.util.Duration +import spock.lang.Specification + +/** + * Apptainer config tests + * + * @author Jorge Ejarque + */ +class ApptainerConfigTest extends Specification { + + def 'should set default values empty map'() { + given: + def config = new ApptainerConfig([:]) + + expect: + config.envWhitelist == [] + config.pullTimeout.toMillis() == 20 * 60 * 1000 //20 min + } + + def 'should create config with full map'(){ + given: + def configMap = [ + autoMounts: false, + cacheDir: 'cacheDir', + enabled: true, + engineOptions: '-q -v', + envWhitelist: 'ENV_1,ENV_2', + libraryDir: 'libraryDir', + noHttps: false, + ociAutoPull: false, + pullTimeout: '50s', + registry: 'http://registry.com', + runOptions: '--contain --writable' + ] + def config = new ApptainerConfig(configMap) + + expect: + config.autoMounts == false + config.cacheDir == 'cacheDir' + config.enabled == true + config.engineOptions == '-q -v' + config.envWhitelist == ['ENV_1','ENV_2'] + config.libraryDir == 'libraryDir' + config.noHttps == false + config.ociAutoPull == false + config.registry == 'http://registry.com' + config.runOptions == '--contain --writable' + config.pullTimeout.toMillis() == 50_000 // 50s + + } +} diff --git a/modules/nextflow/src/test/groovy/nextflow/container/SingularityConfigTest.groovy b/modules/nextflow/src/test/groovy/nextflow/container/SingularityConfigTest.groovy new file mode 100644 index 0000000000..a60043ad68 --- /dev/null +++ b/modules/nextflow/src/test/groovy/nextflow/container/SingularityConfigTest.groovy @@ -0,0 +1,53 @@ +package nextflow.container + + +import spock.lang.Specification + +/** + * Apptainer config tests + * + * @author Jorge Ejarque + */ +class SingularityConfigTest extends Specification { + + def 'should set default values empty map'() { + given: + def config = new SingularityConfig([:]) + + expect: + config.envWhitelist == [] + config.pullTimeout.toMillis() == 20 * 60 * 1000 //20 min + } + + def 'should create config with full map'(){ + given: + def configMap = [ + autoMounts: false, + cacheDir: 'cacheDir', + enabled: true, + engineOptions: '-q -v', + envWhitelist: 'ENV_1,ENV_2', + libraryDir: 'libraryDir', + noHttps: false, + ociAutoPull: false, + pullTimeout: '50s', + registry: 'http://registry.com', + runOptions: '--contain --writable' + ] + def config = new SingularityConfig(configMap) + + expect: + config.autoMounts == false + config.cacheDir == 'cacheDir' + config.enabled == true + config.engineOptions == '-q -v' + config.envWhitelist == ['ENV_1','ENV_2'] + config.libraryDir == 'libraryDir' + config.noHttps == false + config.ociAutoPull == false + config.registry == 'http://registry.com' + config.runOptions == '--contain --writable' + config.pullTimeout.toMillis() == 50_000 // 50s + + } +}