Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
  • Loading branch information
binshi-bing committed Apr 4, 2023
1 parent 5684abd commit 96ec000
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/tso/keyspace_group_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ func runTestLoadKeyspaceGroupsAssignment(
randomGen := rand.New(rand.NewSource(time.Now().UnixNano()))
for j := startID; j < endID; j++ {
assignToMe := false
if randomGen.Intn(100) < probabilityAssignToMe {
// Assign the keyspace group to this host/pod with the given probability,
// and the keyspace group manager only loads the keyspace groups with id
// less than len(mgr.ams).
if j < len(mgr.ams) && randomGen.Intn(100) < probabilityAssignToMe {
assignToMe = true
mux.Lock()
idsExpected = append(idsExpected, j)
Expand Down

0 comments on commit 96ec000

Please sign in to comment.