Skip to content

Commit

Permalink
Making sure async tests properly generate random data (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShivanshVij authored Mar 26, 2024
1 parent 51a4026 commit 6e3ba6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package frisbee

import (
"crypto/rand"
"github.com/stretchr/testify/require"
"testing"

"github.com/loopholelabs/frisbee-go/pkg/packet"
Expand All @@ -31,9 +33,10 @@ func throughputRunner(testSize, packetSize uint32, readerConn, writerConn Conn)
return func(b *testing.B) {
b.SetBytes(int64(testSize * packetSize))
b.ReportAllocs()
var err error

randomData := make([]byte, packetSize)
_, err := rand.Read(randomData)
require.NoError(b, err)

p := packet.Get()
p.Metadata.Id = 64
Expand Down

0 comments on commit 6e3ba6f

Please sign in to comment.