Skip to content

Commit

Permalink
test(pubsublite): print proto type in verifier error messages (#3745)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdiep committed Feb 26, 2021
1 parent 39517ae commit dc24a70
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pubsublite/internal/test/verifier.go
Expand Up @@ -162,15 +162,15 @@ func (v *RPCVerifier) Pop(gotRequest interface{}) (interface{}, error) {
v.numCalls++
elem := v.rpcs.Front()
if elem == nil {
v.t.Errorf("call(%d): unexpected request:\n%v", v.numCalls, gotRequest)
v.t.Errorf("call(%d): unexpected request:\n[%T] %v", v.numCalls, gotRequest, gotRequest)
return nil, status.Error(codes.FailedPrecondition, "mockserver: got unexpected request")
}

rpc, _ := elem.Value.(*rpcMetadata)
v.rpcs.Remove(elem)

if !testutil.Equal(gotRequest, rpc.wantRequest) {
v.t.Errorf("call(%d): got request: %v\nwant request: %v", v.numCalls, gotRequest, rpc.wantRequest)
v.t.Errorf("call(%d): got request: [%T] %v\nwant request: [%T] %v", v.numCalls, gotRequest, gotRequest, rpc.wantRequest, rpc.wantRequest)
}
if err := rpc.wait(); err != nil {
return nil, err
Expand Down Expand Up @@ -213,9 +213,9 @@ func (v *RPCVerifier) Flush() {
v.numCalls++
rpc, _ := elem.Value.(*rpcMetadata)
if rpc.wantRequest != nil {
v.t.Errorf("call(%d): did not receive expected request:\n%v", v.numCalls, rpc.wantRequest)
v.t.Errorf("call(%d): did not receive expected request:\n[%T] %v", v.numCalls, rpc.wantRequest, rpc.wantRequest)
} else {
v.t.Errorf("call(%d): unsent response:\n%v, err = (%v)", v.numCalls, rpc.retResponse, rpc.retErr)
v.t.Errorf("call(%d): unsent response:\n[%T] %v, err = (%v)", v.numCalls, rpc.retResponse, rpc.retResponse, rpc.retErr)
}
}
v.rpcs.Init()
Expand Down

0 comments on commit dc24a70

Please sign in to comment.