Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: you06 <[email protected]>
  • Loading branch information
you06 committed Sep 1, 2023
1 parent 11415ce commit e9a5189
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion session/test/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -967,19 +967,23 @@ func TestRequestSource(t *testing.T) {
return interceptor.NewRPCInterceptor("kv-request-source-verify", func(next interceptor.RPCInterceptorFunc) interceptor.RPCInterceptorFunc {
return func(target string, req *tikvrpc.Request) (*tikvrpc.Response, error) {
requestSource := ""
readType := ""
switch r := req.Req.(type) {
case *kvrpcpb.PrewriteRequest:
requestSource = r.GetContext().GetRequestSource()
case *kvrpcpb.CommitRequest:
requestSource = r.GetContext().GetRequestSource()
case *coprocessor.Request:
readType = "-leader" // read request will be attached with read type
requestSource = r.GetContext().GetRequestSource()
case *kvrpcpb.GetRequest:
readType = "-leader" // read request will be attached with read type
requestSource = r.GetContext().GetRequestSource()
case *kvrpcpb.BatchGetRequest:
readType = "-leader" // read request will be attached with read type
requestSource = r.GetContext().GetRequestSource()
}
require.Equal(t, source, requestSource)
require.Equal(t, source+readType, requestSource)
return next(target, req)
}
})
Expand Down

0 comments on commit e9a5189

Please sign in to comment.