diff options
| author | Marin Ivanov <[email protected]> | 2022-08-15 05:32:02 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2022-08-15 05:32:02 +0300 |
| commit | 88951333595a63af7bdcc91e1519be38cfbce82a (patch) | |
| tree | d6d26292aa5861ae536898482010adb7796bb583 /fs_test.go | |
| parent | 28224be36da864bfca19e30de920dbd195d7ef5b (diff) | |
Test write pipe CloseWithError (unused, though)
Diffstat (limited to 'fs_test.go')
| -rw-r--r-- | fs_test.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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() |
