Skip to content

Commit

Permalink
Fix handling of wave.s5cmdConfigUrl setting [ci fast] (nextflow-io#4707)
Browse files Browse the repository at this point in the history
Signed-off-by: Dr Marco Claudio De La Pierre <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Niklas Schandry <[email protected]>
  • Loading branch information
2 people authored and nschan committed Feb 12, 2024
1 parent a036f1c commit 0ec535b
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 0ec535b

Please sign in to comment.