()
| 626 | } |
| 627 | |
| 628 | func (ed *expectedData) toClientLogEntries() []*binlogpb.GrpcLogEntry { |
| 629 | var ( |
| 630 | ret []*binlogpb.GrpcLogEntry |
| 631 | idInRPC uint64 = 1 |
| 632 | ) |
| 633 | ret = append(ret, ed.newClientHeaderEntry(true, globalRPCID, idInRPC)) |
| 634 | idInRPC++ |
| 635 | |
| 636 | switch ed.cc.callType { |
| 637 | case unaryRPC, fullDuplexStreamRPC: |
| 638 | for i := 0; i < len(ed.requests); i++ { |
| 639 | ret = append(ret, ed.newClientMessageEntry(true, globalRPCID, idInRPC, ed.requests[i])) |
| 640 | idInRPC++ |
| 641 | if i == 0 { |
| 642 | // First message, append ServerHeader. |
| 643 | ret = append(ret, ed.newServerHeaderEntry(true, globalRPCID, idInRPC)) |
| 644 | idInRPC++ |
| 645 | } |
| 646 | if !ed.cc.success { |
| 647 | // There is no response in the RPC error case. |
| 648 | continue |
| 649 | } |
| 650 | ret = append(ret, ed.newServerMessageEntry(true, globalRPCID, idInRPC, ed.responses[i])) |
| 651 | idInRPC++ |
| 652 | } |
| 653 | if ed.cc.success && ed.cc.callType == fullDuplexStreamRPC { |
| 654 | ret = append(ret, ed.newHalfCloseEntry(true, globalRPCID, idInRPC)) |
| 655 | idInRPC++ |
| 656 | } |
| 657 | case clientStreamRPC, serverStreamRPC: |
| 658 | for i := 0; i < len(ed.requests); i++ { |
| 659 | ret = append(ret, ed.newClientMessageEntry(true, globalRPCID, idInRPC, ed.requests[i])) |
| 660 | idInRPC++ |
| 661 | } |
| 662 | if ed.cc.callType == clientStreamRPC { |
| 663 | ret = append(ret, ed.newHalfCloseEntry(true, globalRPCID, idInRPC)) |
| 664 | idInRPC++ |
| 665 | } |
| 666 | ret = append(ret, ed.newServerHeaderEntry(true, globalRPCID, idInRPC)) |
| 667 | idInRPC++ |
| 668 | if ed.cc.success { |
| 669 | for i := 0; i < len(ed.responses); i++ { |
| 670 | ret = append(ret, ed.newServerMessageEntry(true, globalRPCID, idInRPC, ed.responses[0])) |
| 671 | idInRPC++ |
| 672 | } |
| 673 | } |
| 674 | } |
| 675 | |
| 676 | if ed.cc.callType == cancelRPC { |
| 677 | ret = append(ret, ed.newCancelEntry(globalRPCID, idInRPC)) |
| 678 | idInRPC++ |
| 679 | } else { |
| 680 | ret = append(ret, ed.newServerTrailerEntry(true, globalRPCID, idInRPC, ed.err)) |
| 681 | idInRPC++ |
| 682 | } |
| 683 | return ret |
| 684 | } |
| 685 |
no test coverage detected