summaryrefslogtreecommitdiff
path: root/fs_test.go
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2022-08-15 06:16:55 +0300
committerMarin Ivanov <[email protected]>2022-08-15 06:16:55 +0300
commitf8fc14b2e0a10c64de0bd87f831ebde4f705b79b (patch)
tree5477a9fbca3be41a7e3ecb9a73eb37ae51b5fbfb /fs_test.go
parent88951333595a63af7bdcc91e1519be38cfbce82a (diff)
Optimize for files larger than 16MiB
Diffstat (limited to 'fs_test.go')
-rw-r--r--fs_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs_test.go b/fs_test.go
index 550c199..7e9765c 100644
--- a/fs_test.go
+++ b/fs_test.go
@@ -1,6 +1,7 @@
package s3
import (
+ cryptorand "crypto/rand"
"errors"
"io"
"os"
@@ -98,6 +99,23 @@ func TestFsWriteError(t *testing.T) {
is.Equal(err, os.ErrNotExist)
}
+func TestFsWrite17MB(t *testing.T) {
+ is := is.New(t)
+ afs, cleanup := newTestAfs()
+ defer cleanup()
+
+ f, err := afs.Fs.Create("dir/file")
+ is.NoErr(err)
+ r := io.LimitReader(cryptorand.Reader, 17*(1<<20))
+ _, err = io.Copy(f, r)
+ is.NoErr(err)
+ err = f.Close()
+ is.NoErr(err)
+ info, err := afs.Stat("dir/file")
+ is.NoErr(err)
+ is.Equal(info.Size(), int64(17*(1<<20)))
+}
+
func TestFsStat(t *testing.T) {
is := is.New(t)
afs, cleanup := newTestAfs()