diff options
author | Jakob Unterwurzacher | 2023-06-08 15:04:22 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2023-06-09 07:29:49 +0200 |
commit | 2b416942b0366c41672bf6bab69b2f1a1ceb5f5d (patch) | |
tree | 5a12e3886a0fae2998de7c5c634992b3d1d82b12 /tests/cluster | |
parent | c1c41d279a33afdeb930009bdd305c39a9920dcf (diff) |
tests/cluster: TestConcurrentCreate: make sure buf2 is zero'ed
Diffstat (limited to 'tests/cluster')
-rw-r--r-- | tests/cluster/cluster_test.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/cluster/cluster_test.go b/tests/cluster/cluster_test.go index d788bdb..55a2b99 100644 --- a/tests/cluster/cluster_test.go +++ b/tests/cluster/cluster_test.go @@ -8,6 +8,7 @@ package cluster_test import ( "bytes" "errors" + "io" "math/rand" "os" "sync" @@ -149,7 +150,6 @@ func TestConcurrentCreate(t *testing.T) { workerThread := func(path string) { defer wg.Done() buf := make([]byte, 10) - buf2 := make([]byte, 10) for i := 0; i < loops; i++ { if t.Failed() { return @@ -165,11 +165,13 @@ func TestConcurrentCreate(t *testing.T) { t.Errorf("iteration %d: Pwrite: %v", i, err) return } - _, err = f.ReadAt(buf2, 0) - if err != nil { + buf2 := make([]byte, len(buf)+1) + n, err := f.ReadAt(buf2, 0) + if err != nil && err != io.EOF { t.Errorf("iteration %d: ReadAt: %v", i, err) return } + buf2 = buf2[:n] if !bytes.Equal(buf, buf2) { t.Errorf("iteration %d: corrupt data received: %x", i, buf2) return |