|
|
@ -123,11 +123,11 @@ func TestProtocolState_String(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
type noopServerHandler struct{}
|
|
|
|
type noopServerHandler struct{}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopServerHandler) CommandAnnounce(context.Context, chan []byte) (*Command, error) {
|
|
|
|
func (h *noopServerHandler) CommandAnnounce(context.Context, <-chan []byte) (*Command, error) {
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopServerHandler) CommandData(context.Context, chan []byte, *Command) error {
|
|
|
|
func (h *noopServerHandler) CommandData(context.Context, <-chan []byte, *Command) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ func (h *noopServerHandler) HandleCommand(context.Context, *Command) (*Response,
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopServerHandler) Respond(context.Context, *Response, chan []byte) error {
|
|
|
|
func (h *noopServerHandler) Respond(context.Context, *Response, chan<- []byte) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -143,7 +143,7 @@ type testServerHandler struct {
|
|
|
|
logger *logrus.Logger
|
|
|
|
logger *logrus.Logger
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testServerHandler) CommandAnnounce(ctx context.Context, in chan []byte) (*Command, error) {
|
|
|
|
func (h *testServerHandler) CommandAnnounce(ctx context.Context, in <-chan []byte) (*Command, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -154,7 +154,7 @@ func (h *testServerHandler) CommandAnnounce(ctx context.Context, in chan []byte)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testServerHandler) CommandData(ctx context.Context, in chan []byte, command *Command) error {
|
|
|
|
func (h *testServerHandler) CommandData(ctx context.Context, in <-chan []byte, command *Command) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -176,7 +176,7 @@ func (h *testServerHandler) HandleCommand(_ context.Context, command *Command) (
|
|
|
|
}, nil
|
|
|
|
}, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testServerHandler) Respond(ctx context.Context, response *Response, out chan []byte) error {
|
|
|
|
func (h *testServerHandler) Respond(ctx context.Context, response *Response, out chan<- []byte) error {
|
|
|
|
h.logger.Info("send response")
|
|
|
|
h.logger.Info("send response")
|
|
|
|
|
|
|
|
|
|
|
|
buf := bytes.NewBuffer([]byte("test-response-"))
|
|
|
|
buf := bytes.NewBuffer([]byte("test-response-"))
|
|
|
@ -192,7 +192,7 @@ func (h *testServerHandler) Respond(ctx context.Context, response *Response, out
|
|
|
|
|
|
|
|
|
|
|
|
type commandAnnounceErrServerHandler struct{ testServerHandler }
|
|
|
|
type commandAnnounceErrServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *commandAnnounceErrServerHandler) CommandAnnounce(ctx context.Context, in chan []byte) (*Command, error) {
|
|
|
|
func (h *commandAnnounceErrServerHandler) CommandAnnounce(ctx context.Context, in <-chan []byte) (*Command, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -203,7 +203,7 @@ func (h *commandAnnounceErrServerHandler) CommandAnnounce(ctx context.Context, i
|
|
|
|
|
|
|
|
|
|
|
|
type commandAnnounceNilServerHandler struct{ testServerHandler }
|
|
|
|
type commandAnnounceNilServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *commandAnnounceNilServerHandler) CommandAnnounce(ctx context.Context, in chan []byte) (*Command, error) {
|
|
|
|
func (h *commandAnnounceNilServerHandler) CommandAnnounce(ctx context.Context, in <-chan []byte) (*Command, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -214,7 +214,7 @@ func (h *commandAnnounceNilServerHandler) CommandAnnounce(ctx context.Context, i
|
|
|
|
|
|
|
|
|
|
|
|
type commandDataErrServerHandler struct{ testServerHandler }
|
|
|
|
type commandDataErrServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *commandDataErrServerHandler) CommandData(ctx context.Context, in chan []byte, _ *Command) error {
|
|
|
|
func (h *commandDataErrServerHandler) CommandData(ctx context.Context, in <-chan []byte, _ *Command) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -226,8 +226,7 @@ func (h *commandDataErrServerHandler) CommandData(ctx context.Context, in chan [
|
|
|
|
type commandDataNilAnnouncementServerHandler struct{ testServerHandler }
|
|
|
|
type commandDataNilAnnouncementServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *commandDataNilAnnouncementServerHandler) CommandAnnounce(
|
|
|
|
func (h *commandDataNilAnnouncementServerHandler) CommandAnnounce(
|
|
|
|
ctx context.Context,
|
|
|
|
ctx context.Context, in <-chan []byte,
|
|
|
|
in chan []byte,
|
|
|
|
|
|
|
|
) (*Command, error) {
|
|
|
|
) (*Command, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
@ -245,7 +244,7 @@ func (h *handleCommandErrServerHandler) HandleCommand(_ context.Context, command
|
|
|
|
|
|
|
|
|
|
|
|
type handleCommandNilCommandServerHandler struct{ testServerHandler }
|
|
|
|
type handleCommandNilCommandServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *handleCommandNilCommandServerHandler) CommandData(ctx context.Context, in chan []byte, _ *Command) error {
|
|
|
|
func (h *handleCommandNilCommandServerHandler) CommandData(ctx context.Context, in <-chan []byte, _ *Command) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -256,7 +255,7 @@ func (h *handleCommandNilCommandServerHandler) CommandData(ctx context.Context,
|
|
|
|
|
|
|
|
|
|
|
|
type respondErrServerHandler struct{ testServerHandler }
|
|
|
|
type respondErrServerHandler struct{ testServerHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *respondErrServerHandler) Respond(_ context.Context, r *Response, _ chan []byte) error {
|
|
|
|
func (h *respondErrServerHandler) Respond(_ context.Context, r *Response, _ chan<- []byte) error {
|
|
|
|
return fmt.Errorf("failed to respond %s", r)
|
|
|
|
return fmt.Errorf("failed to respond %s", r)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -914,15 +913,15 @@ func readServerResponse(ctx context.Context, out chan []byte) []byte {
|
|
|
|
|
|
|
|
|
|
|
|
type noopClientHandler struct{}
|
|
|
|
type noopClientHandler struct{}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopClientHandler) Send(context.Context, *Command, chan []byte) error {
|
|
|
|
func (h *noopClientHandler) Send(context.Context, *Command, chan<- []byte) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopClientHandler) ResponseAnnounce(context.Context, chan []byte) (*Response, error) {
|
|
|
|
func (h *noopClientHandler) ResponseAnnounce(context.Context, <-chan []byte) (*Response, error) {
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *noopClientHandler) ResponseData(context.Context, chan []byte, *Response) error {
|
|
|
|
func (h *noopClientHandler) ResponseData(context.Context, <-chan []byte, *Response) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -932,7 +931,7 @@ func (h *noopClientHandler) HandleResponse(context.Context, *Response) error {
|
|
|
|
|
|
|
|
|
|
|
|
type testClientHandler struct{ logger *logrus.Logger }
|
|
|
|
type testClientHandler struct{ logger *logrus.Logger }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testClientHandler) Send(ctx context.Context, command *Command, out chan []byte) error {
|
|
|
|
func (h *testClientHandler) Send(ctx context.Context, command *Command, out chan<- []byte) error {
|
|
|
|
h.logger.Infof("send command %s", command.Announce.Code)
|
|
|
|
h.logger.Infof("send command %s", command.Announce.Code)
|
|
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
select {
|
|
|
@ -957,7 +956,7 @@ func (h *testClientHandler) Send(ctx context.Context, command *Command, out chan
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testClientHandler) ResponseAnnounce(ctx context.Context, in chan []byte) (*Response, error) {
|
|
|
|
func (h *testClientHandler) ResponseAnnounce(ctx context.Context, in <-chan []byte) (*Response, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -970,7 +969,7 @@ func (h *testClientHandler) ResponseAnnounce(ctx context.Context, in chan []byte
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (h *testClientHandler) ResponseData(ctx context.Context, in chan []byte, response *Response) error {
|
|
|
|
func (h *testClientHandler) ResponseData(ctx context.Context, in <-chan []byte, response *Response) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -991,7 +990,7 @@ func (h *testClientHandler) HandleResponse(_ context.Context, response *Response
|
|
|
|
|
|
|
|
|
|
|
|
type commandAnnounceErrClientHandler struct{ testClientHandler }
|
|
|
|
type commandAnnounceErrClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *commandAnnounceErrClientHandler) Send(context.Context, *Command, chan []byte) error {
|
|
|
|
func (h *commandAnnounceErrClientHandler) Send(context.Context, *Command, chan<- []byte) error {
|
|
|
|
return errors.New("failed sending command")
|
|
|
|
return errors.New("failed sending command")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1011,7 +1010,7 @@ func TestNewClient(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
|
|
type responseAnnounceErrClientHandler struct{ testClientHandler }
|
|
|
|
type responseAnnounceErrClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *responseAnnounceErrClientHandler) ResponseAnnounce(ctx context.Context, in chan []byte) (*Response, error) {
|
|
|
|
func (h *responseAnnounceErrClientHandler) ResponseAnnounce(ctx context.Context, in <-chan []byte) (*Response, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -1022,7 +1021,7 @@ func (h *responseAnnounceErrClientHandler) ResponseAnnounce(ctx context.Context,
|
|
|
|
|
|
|
|
|
|
|
|
type responseAnnounceNilClientHandler struct{ testClientHandler }
|
|
|
|
type responseAnnounceNilClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *responseAnnounceNilClientHandler) ResponseAnnounce(ctx context.Context, in chan []byte) (*Response, error) {
|
|
|
|
func (h *responseAnnounceNilClientHandler) ResponseAnnounce(ctx context.Context, in <-chan []byte) (*Response, error) {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil, nil
|
|
|
|
return nil, nil
|
|
|
@ -1033,7 +1032,7 @@ func (h *responseAnnounceNilClientHandler) ResponseAnnounce(ctx context.Context,
|
|
|
|
|
|
|
|
|
|
|
|
type responseDataErrClientHandler struct{ testClientHandler }
|
|
|
|
type responseDataErrClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *responseDataErrClientHandler) ResponseData(ctx context.Context, in chan []byte, _ *Response) error {
|
|
|
|
func (h *responseDataErrClientHandler) ResponseData(ctx context.Context, in <-chan []byte, _ *Response) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -1044,7 +1043,7 @@ func (h *responseDataErrClientHandler) ResponseData(ctx context.Context, in chan
|
|
|
|
|
|
|
|
|
|
|
|
type responseDataTimeoutErrClientHandler struct{ testClientHandler }
|
|
|
|
type responseDataTimeoutErrClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *responseDataTimeoutErrClientHandler) ResponseData(ctx context.Context, in chan []byte, _ *Response) error {
|
|
|
|
func (h *responseDataTimeoutErrClientHandler) ResponseData(ctx context.Context, in <-chan []byte, _ *Response) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -1055,7 +1054,7 @@ func (h *responseDataTimeoutErrClientHandler) ResponseData(ctx context.Context,
|
|
|
|
|
|
|
|
|
|
|
|
type responseDataNilClientHandler struct{ testClientHandler }
|
|
|
|
type responseDataNilClientHandler struct{ testClientHandler }
|
|
|
|
|
|
|
|
|
|
|
|
func (h *responseDataNilClientHandler) ResponseData(ctx context.Context, in chan []byte, response *Response) error {
|
|
|
|
func (h *responseDataNilClientHandler) ResponseData(ctx context.Context, in <-chan []byte, response *Response) error {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
case <-ctx.Done():
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
@ -1194,6 +1193,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
@ -1377,6 +1377,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.ErrorLevel, "could not handle response announce"},
|
|
|
|
{logrus.ErrorLevel, "could not handle response announce"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
@ -1441,6 +1442,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -1505,6 +1507,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.ErrorLevel, "could not handle response data"},
|
|
|
|
{logrus.ErrorLevel, "could not handle response data"},
|
|
|
@ -1571,6 +1574,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.ErrorLevel, "could not handle response data"},
|
|
|
|
{logrus.ErrorLevel, "could not handle response data"},
|
|
|
@ -1637,6 +1641,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
@ -1703,6 +1708,7 @@ func TestClientProtocol_Handle(t *testing.T) { //nolint:cyclop
|
|
|
|
|
|
|
|
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
assertLogs(t, pHook, []expectedLogs{
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", cmdAnnounce)},
|
|
|
|
|
|
|
|
{logrus.TraceLevel, "handled command"},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respAnnounce)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", respData)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
|
{logrus.DebugLevel, fmt.Sprintf("handling protocol state %s", handleResponse)},
|
|
|
|