From 58339a5cb6b184cce05ef54471fb9dd09e63edb2 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 16 Aug 2018 15:52:15 +0100 Subject: [PATCH] fstests: In TestFsPutError reliably provoke test failure This change to go1.11 causes the TestFsPutError test to fail https://go-review.googlesource.com/c/go/+/114316 This is because it now passes the half written file to the backend whereas it didn't previously because of the buffering. In this commit the size of the data written was increased to 5k from 50 bytes to provoke the test failure under go1.10 also. --- fstest/fstests/fstests.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go index 9a4f180b5..4f2738860 100644 --- a/fstest/fstests/fstests.go +++ b/fstest/fstests/fstests.go @@ -382,13 +382,14 @@ func Run(t *testing.T, opt *Opt) { t.Run("TestFsPutError", func(t *testing.T) { skipIfNotOk(t) - // Read 50 bytes then produce an error - contents := fstest.RandomString(50) + const N = 5 * 1024 + // Read N bytes then produce an error + contents := fstest.RandomString(N) buf := bytes.NewBufferString(contents) er := &errorReader{errors.New("potato")} in := io.MultiReader(buf, er) - obji := object.NewStaticObjectInfo(file2.Path, file2.ModTime, 100, true, nil, nil) + obji := object.NewStaticObjectInfo(file2.Path, file2.ModTime, 2*N, true, nil, nil) _, err := remote.Put(in, obji) // assert.Nil(t, obj) - FIXME some remotes return the object even on nil assert.NotNil(t, err)