Skip to content

Commit

Permalink
test upload
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Sep 5, 2024
1 parent 24d28b4 commit ac16616
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import java.nio.file.CopyOption
import java.nio.file.StandardCopyOption
import java.nio.file.DirectoryStream
import groovy.util.logging.Slf4j
import spock.lang.IgnoreIf

/**
*
Expand Down Expand Up @@ -94,6 +95,30 @@ class QuiltFileSystemProviderTest extends QuiltSpecification {
Files.list(tempFolder).count() > 0
}

@IgnoreIf({ env.WRITE_BUCKET == null })
void 'should upload file to test bucket'() {
given:
QuiltFileSystemProvider provider = new QuiltFileSystemProvider()
String url = writeableURL('upload')
String filename = 'UPLOAD_THIS.md'
QuiltPath remotePath = QuiltPathFactory.parse(url)
QuiltPath remoteFile = remotePath.resolveSibling(filename)
Path tempFolder = Files.createTempDirectory('quilt')
Path tempFile = tempFolder.resolve(filename)
// write test file
Files.writeString(tempFile, 'This is a test file')

expect:
!Files.exists(remoteFile.localPath())

when:
provider.upload(tempFile, remoteFile)

then:
Files.exists(remoteFile)
Files.size(remoteFile) > 0
}

void 'should fail to upload a file to itself'() {
given:
QuiltFileSystemProvider provider = new QuiltFileSystemProvider()
Expand Down

0 comments on commit ac16616

Please sign in to comment.