storagenode/piecestore: Change test to use ioutil.ReadAll to attempt to reduce test flake (#3250)

This commit is contained in:
Isaac Hess 2019-10-11 15:57:59 -06:00 committed by GitHub
parent a1275746b4
commit e567f27634
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ package piecestore_test
import (
"context"
"io/ioutil"
"testing"
"time"
@ -288,14 +289,8 @@ func TestOrderLimitGetValidation(t *testing.T) {
downloader, err := client.Download(ctx, orderLimit, piecePrivateKey, 0, tt.limit)
require.NoError(t, err)
var readErr error
buffer := make([]byte, memory.KiB)
for i := 0; i < 10; i++ {
_, readErr = downloader.Read(buffer)
if readErr != nil {
break
}
}
buffer, readErr := ioutil.ReadAll(downloader)
require.Equal(t, 0, len(buffer))
closeErr := downloader.Close()
err = errs.Combine(readErr, closeErr)
if tt.err != "" {