Skip to content

Commit

Permalink
test: fix rand.Read will generate same key (#46870)
Browse files Browse the repository at this point in the history
close #46869
  • Loading branch information
lance6716 authored Sep 11, 2023
1 parent f0a5529 commit 17baf99
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions br/pkg/lightning/backend/external/split_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ func TestGeneralProperties(t *testing.T) {
for i := range keys {
keyLen := rand.Intn(100) + 1
valueLen := rand.Intn(100) + 1
keys[i] = make([]byte, keyLen)
values[i] = make([]byte, valueLen)
rand.Read(keys[i])
rand.Read(values[i])
keys[i] = make([]byte, keyLen+2)
values[i] = make([]byte, valueLen+2)
rand.Read(keys[i][:keyLen])
rand.Read(values[i][:valueLen])
keys[i][keyLen] = byte(i / 255)
keys[i][keyLen+1] = byte(i % 255)
values[i][valueLen] = byte(i / 255)
values[i][valueLen+1] = byte(i % 255)
}

dataFiles, statFiles, err := MockExternalEngine(memStore, keys, values)
Expand Down

0 comments on commit 17baf99

Please sign in to comment.