Skip to content

Commit

Permalink
read random bytes rather than generate from string
Browse files Browse the repository at this point in the history
  • Loading branch information
kheina committed Aug 13, 2024
1 parent 764d51a commit a775cf6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions plugin/service/storage/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bufio"
"bytes"
"context"
"crypto/rand"
"crypto/sha256"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -2676,16 +2677,19 @@ func TestPutObject(t *testing.T) {
}
defer file.Close()

data := []byte("test file data\n")
filedata := []byte{}

for range 10000000 {
filedata = append(filedata, data...)
data := make([]byte, 30e6)
n, err := rand.Reader.Read(data)
if err != nil {
return nil, err
}
if n != 30e6 {
return nil, fmt.Errorf("did not read 30 million bytes")
}
if _, err = file.Write(filedata); err != nil {

if _, err = file.Write(data); err != nil {
return nil, err
}
return filedata, nil
return data, nil
},
},
}
Expand Down

0 comments on commit a775cf6

Please sign in to comment.