Skip to content

Commit

Permalink
Fix handling of wave.s5cmdConfigUrl setting [ci fast] (#4707)
Browse files Browse the repository at this point in the history

Signed-off-by: Dr Marco Claudio De La Pierre <marco.delapierre@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
marcodelapierre and pditommaso committed Feb 1, 2024
1 parent d1b3195 commit 3a19386
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/nf-commons/src/main/nextflow/extension/Bolts.groovy
Expand Up @@ -443,6 +443,12 @@ class Bolts {
else if( type == RateUnit ) {
return new RateUnit(self)
}
else if ( type == URL ) {
return new URL(self)
}
else if ( type == URI ) {
return URI.create(self)
}

StringGroovyMethods.asType(self, type);
}
Expand All @@ -464,6 +470,12 @@ class Bolts {
else if( type == MemoryUnit ) {
return new MemoryUnit(self.toString())
}
else if ( type == URL ) {
return new URL(self.toString())
}
else if ( type == URI ) {
return URI.create(self.toString())
}

StringGroovyMethods.asType(self, type);
}
Expand Down
12 changes: 12 additions & 0 deletions modules/nf-commons/src/test/nextflow/extension/BoltsTest.groovy
Expand Up @@ -145,6 +145,18 @@ class BoltsTest extends Specification {
"$x MB" as MemoryUnit == MemoryUnit.of('5 MB')
}

def testAsURL() {
expect:
'http://foo.com' as URL == new URL('http://foo.com')
'http://foo.com/some/file.txt' as URL == new URL('http://foo.com/some/file.txt')
}

def testAsURI() {
expect:
'http://foo.com' as URI == URI.create('http://foo.com')
'http://foo.com/some/file.txt' as URI == URI.create('http://foo.com/some/file.txt')
}

def testConfigToMap () {

setup:
Expand Down
Expand Up @@ -1248,6 +1248,15 @@ class WaveClientTest extends Specification {
'linux/arm64/v8' | 'https://nf-xpack.seqera.io/s5cmd/linux_arm64_2.0.0.json'
}

def 'should configure custom s5cmd' () {
given:
def sess = Mock(Session) {getConfig() >> [wave:[s5cmdConfigUrl: 'http://host.com/s5cmd.zip']] }
when:
def wave = Spy(new WaveClient(sess))
then:
wave.@s5cmdConfigUrl == new URL('http://host.com/s5cmd.zip')
}

def 'should check is local conda file' () {
expect:
WaveClient.isCondaLocalFile(CONTENT) == EXPECTED
Expand Down

0 comments on commit 3a19386

Please sign in to comment.