Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package nextflow.container

import nextflow.util.Duration
import spock.lang.Specification

/**
* Apptainer config tests
*
* @author Jorge Ejarque <jorge.ejarque@seqera.io>
*/
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

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package nextflow.container


import spock.lang.Specification

/**
* Apptainer config tests
*
* @author Jorge Ejarque <jorge.ejarque@seqera.io>
*/
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

}
}
Loading