From a0ad1de656fb5c9963da08e7556d961f2bb095d0 Mon Sep 17 00:00:00 2001 From: "Dr. Ernie Prabhakar" <19791+drernie@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:57:48 -0700 Subject: [PATCH] improve coverage --- .../quilt/nio/QuiltFileSystemProvider.groovy | 4 ---- .../nextflow/quilt/QuiltProductTest.groovy | 18 +++++++++++++++++- .../nio/QuiltFileSystemProviderTest.groovy | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy index 451ffc74..5ed5ad7e 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy @@ -110,10 +110,6 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr log.info "download Quilt package: ${pkg} installed? ${pkg.installed}" if (!pkg.installed) { Path dest = pkg.install() - if (!dest) { - log.error "download.install failed: ${pkg}" - throw new IOException("Failed to install Quilt package: ${pkg}") - } log.info "download.installed Quilt package to: $dest" } diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy index 72b0631b..4e3d2344 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/QuiltProductTest.groovy @@ -63,7 +63,7 @@ class QuiltProductTest extends QuiltSpecification { } QuiltProduct makeWriteProduct(Map meta = [:]) { - String subURL = writeableURI('quilt_product_test') + '&workflow=my-workflow' + String subURL = writeableURI('quilt_product_test') // + '&workflow=universal' if (meta) { String query = QuiltParser.unparseQuery(meta) subURL = subURL.replace('#', "?${query}#") @@ -169,6 +169,22 @@ class QuiltProductTest extends QuiltSpecification { quilt_summarize.size() == 1 } + void 'should copyFile'() { + given: + QuiltProduct product = makeWriteProduct() + String filename = 'test.md' + String text = 'test' + Path src = Paths.get(product.pkg.folder.toString(), filename) + Path dest = Paths.get(product.pkg.folder.toString(), 'copy', filename) + Files.writeString(src, text) + + when: + product.copyFile(src, dest.toString(), text) + + then: + Files.exists(dest) + } + @Ignore('Not implemented yet: pushes previous metadata') void 'pushes previous metadata if metadata=SKIP'() { given: diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy index 2beb0745..b302091f 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy @@ -124,7 +124,8 @@ class QuiltFileSystemProviderTest extends QuiltSpecification { !Files.exists(remoteFile.localPath()) when: - provider.upload(tempFile, remoteFile) + CopyOption opt = StandardCopyOption.REPLACE_EXISTING + provider.upload(tempFile, remoteFile, opt) then: Files.exists(remoteFile)