Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fstests: add integration test for uploading empty files

Nick Craig-Wood3245c0ae0d6a
diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go
index f652a2857..c144b7319 100644
--- a/fstest/fstests/fstests.go
+++ b/fstest/fstests/fstests.go
@@ -189,6 +189,9 @@ func testPutLarge(t *testing.T, f fs.Fs, file *fstest.Item) {
obji := object.NewStaticObjectInfo(file.Path, file.ModTime, file.Size, true, nil, nil)
obj, err = f.Put(context.Background(), in, obji)
+ if file.Size == 0 && err == fs.ErrorCantUploadEmptyFiles {
+ t.Skip("Can't upload zero length files")
+ }
return err
})
file.Hashes = uploadHash.Sums()
@@ -675,6 +678,16 @@ func Run(t *testing.T, opt *Opt) {
}
})
+ t.Run("FsPutZeroLength", func(t *testing.T) {
+ skipIfNotOk(t)
+
+ testPutLarge(t, remote, &fstest.Item{
+ ModTime: fstest.Time("2001-02-03T04:05:06.499999999Z"),
+ Path: fmt.Sprintf("zero-length-file"),
+ Size: int64(0),
+ })
+ })
+
t.Run("FsOpenWriterAt", func(t *testing.T) {
skipIfNotOk(t)
openWriterAt := remote.Features().OpenWriterAt