This commit is contained in:
@@ -218,7 +218,7 @@ func TestLimitedWriterWrite(t *testing.T) {
|
||||
|
||||
// A buffer with random data that is larger than the write size and not
|
||||
// a precise multiple either.
|
||||
src := make([]byte, int(12.5*maxSingleWriteSize))
|
||||
src := make([]byte, int(12.5*8192))
|
||||
if _, err := crand.Reader.Read(src); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -242,9 +242,14 @@ func TestLimitedWriterWrite(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Verify there were lots of writes and that the end result is identical.
|
||||
if cw.writeCount != 13 {
|
||||
t.Error("expected lots of smaller writes, but not too many")
|
||||
// Verify there were lots of writes (we expect one kilobyte write size
|
||||
// for the very low rate in this test) and that the end result is
|
||||
// identical.
|
||||
if cw.writeCount < 10*8 {
|
||||
t.Error("expected lots of smaller writes")
|
||||
}
|
||||
if cw.writeCount > 15*8 {
|
||||
t.Error("expected fewer larger writes")
|
||||
}
|
||||
if !bytes.Equal(src, dst.Bytes()) {
|
||||
t.Error("results should be equal")
|
||||
@@ -319,8 +324,11 @@ func TestLimitedWriterWrite(t *testing.T) {
|
||||
}
|
||||
|
||||
// Verify there were lots of writes and that the end result is identical.
|
||||
if cw.writeCount != 13 {
|
||||
t.Error("expected just the one write")
|
||||
if cw.writeCount < 10*8 {
|
||||
t.Error("expected lots of smaller writes")
|
||||
}
|
||||
if cw.writeCount > 15*8 {
|
||||
t.Error("expected fewer larger writes")
|
||||
}
|
||||
if !bytes.Equal(src, dst.Bytes()) {
|
||||
t.Error("results should be equal")
|
||||
|
||||
Reference in New Issue
Block a user