Skip to content

Commit

Permalink
fail relativeChildren
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Sep 8, 2023
1 parent 52bdba6 commit 01b268e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
15 changes: 6 additions & 9 deletions plugins/nf-quilt/src/main/nextflow/quilt/jep/QuiltPackage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,13 @@ class QuiltPackage {
*/

List<String> relativeChildren(String subpath) {
Manifest manifest = packageManifest()
// get names of entries
List<String> children = manifest.getEntries().keySet().collect { String key ->
if (key.startsWith(subpath)) {
return key
}
return null
Set<String> keys = packageManifest().getEntries().keySet()
println("relativeChildren[${subpath}]: ${keys}")
Collection children = keys.findResults { String key ->
key.startsWith(subpath) ? key : null
}
return children
println("relativeChildren.children: ${children}")
return children as List<String>
}

void reset() {
Expand Down Expand Up @@ -240,7 +238,6 @@ class QuiltPackage {
Namespace namespace = packageNamespace()
Manifest.Builder builder = Manifest.builder()
Files.walk(packageDest()).filter(f -> Files.isRegularFile(f)).forEach(f -> {
println(f)
String logicalKey = packageDest().relativize(f)
LocalPhysicalKey physicalKey = new LocalPhysicalKey(f)
long size = Files.size(f)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import nextflow.quilt.nio.QuiltPath

import spock.lang.Ignore
import spock.lang.IgnoreIf
import spock.lang.Unroll
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths
Expand Down Expand Up @@ -63,6 +64,25 @@ class QuiltPackageTest extends QuiltSpecification {
pkg == pkg2
}

@Unroll
void 'should find relativeChildren of complete folders'() {
given:
Path path = Paths.get(new URI(PACKAGE_URL))
when:
QuiltPackage pkg = path.pkg()
then:
pkg.relativeChildren(subpath).size() == expected_size

where:
subpath | expected_size
'' | 8
'.ipynb_checkpoints' | 1
'/.ipynb_checkpoints' | 1
'.ipynb' | 1
'/.ipynb' | 0

}

void 'should distinguish Packages with same name in different Buckets '() {
given:
def url2 = TEST_URL.replace('quilt-', 'quilted-')
Expand Down

0 comments on commit 01b268e

Please sign in to comment.