summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Ivanov <[email protected]>2022-08-15 05:32:02 +0300
committerMarin Ivanov <[email protected]>2022-08-15 05:32:02 +0300
commit88951333595a63af7bdcc91e1519be38cfbce82a (patch)
treed6d26292aa5861ae536898482010adb7796bb583
parent28224be36da864bfca19e30de920dbd195d7ef5b (diff)
Test write pipe CloseWithError (unused, though)
-rw-r--r--fs_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs_test.go b/fs_test.go
index 2f670cf..550c199 100644
--- a/fs_test.go
+++ b/fs_test.go
@@ -1,6 +1,8 @@
package s3
import (
+ "errors"
+ "io"
"os"
"testing"
"time"
@@ -80,6 +82,22 @@ func TestFsWriteFile(t *testing.T) {
is.NoErr(err)
}
+func TestFsWriteError(t *testing.T) {
+ is := is.New(t)
+ afs, cleanup := newTestAfs()
+ defer cleanup()
+
+ f, err := afs.Fs.Create("dir/file")
+ is.NoErr(err)
+ w := f.(*File).w.(*io.PipeWriter)
+ _, err = w.Write(testdata)
+ is.NoErr(err)
+ err = w.CloseWithError(errors.New("disk died"))
+ is.NoErr(err)
+ _, err = afs.Stat("dir/file")
+ is.Equal(err, os.ErrNotExist)
+}
+
func TestFsStat(t *testing.T) {
is := is.New(t)
afs, cleanup := newTestAfs()