Skip to content

Commit

Permalink
kvserver: use BarchRequest.GetArg
Browse files Browse the repository at this point in the history
Epic: none
Release note: none
  • Loading branch information
pav-kv committed Nov 3, 2023
1 parent 1d00234 commit f06aa83
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions pkg/kv/kvserver/replica_raft_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,12 @@ func testProposalsWithInjectedLeaseIndexAndReproposalError(t *testing.T, pipelin
isOurCommand := func(ba *kvpb.BatchRequest) (_ string, ok bool) {
if ba == nil {
return "", false // not local proposal
}
var inc *kvpb.IncrementRequest
for i := range ba.Requests {
if inc = ba.Requests[i].GetIncrement(); inc != nil {
break
}
}
if inc == nil {
return "", false
}
key := string(inc.Key)
if !strings.HasSuffix(key, "-testing") {
} else if inc, found := ba.GetArg(kvpb.Increment); !found {
return "", false
} else if key := string(inc.(*kvpb.IncrementRequest).Key); strings.HasSuffix(key, "-testing") {
return key, true
}
return key, true
return "", false
}

rnd, seed := randutil.NewPseudoRand()
Expand Down

0 comments on commit f06aa83

Please sign in to comment.