From bb55b5a9b19c56e99549ce8bd76c1074ec9eba22 Mon Sep 17 00:00:00 2001 From: Pritesh Bandi Date: Sun, 20 Aug 2023 22:24:44 -0700 Subject: [PATCH] CR feedback Signed-off-by: Pritesh Bandi --- cli/cli.go | 4 ++-- cli/cli_test.go | 21 --------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 1e09c54..eb030a1 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -143,7 +143,7 @@ func unmarshalRequest(ctx context.Context, request any) error { func marshalResponse(ctx context.Context, response any, err error) (string, *plugin.Error) { logger := log.GetLogger(ctx) if err != nil { - logger.Errorf("%s error :%v", reflect.TypeOf(response), err) + logger.Errorf("%s error: %v", reflect.TypeOf(response), err) if plgErr, ok := err.(*plugin.Error); ok { return "", plgErr } @@ -157,6 +157,6 @@ func marshalResponse(ctx context.Context, response any, err error) (string, *plu return "", plugin.NewGenericErrorf(plugin.ErrorMsgMalformedOutputFmt, err.Error()) } - logger.Debugf("%s response :%s", reflect.TypeOf(response), jsonResponse) + logger.Debugf("%s response: %s", reflect.TypeOf(response), jsonResponse) return string(jsonResponse), nil } diff --git a/cli/cli_test.go b/cli/cli_test.go index a5bdf9a..3049826 100644 --- a/cli/cli_test.go +++ b/cli/cli_test.go @@ -106,27 +106,6 @@ func setupReader(content string) func() { } } -//func TestUnmarshalRequest(t *testing.T) { -// ctx := context.Background() -// req := plugin.GenerateSignatureRequest{ -// ContractVersion: "1.0", -// KeyID: "keyId", -// KeySpec: plugin.KeySpecEC384, -// Hash: plugin.HashAlgorithmSHA384, -// Payload: []byte("payload"), -// } -// -// err := unmarshalRequest(ctx, req) -// if err != nil { -// t.Errorf("Error found in marshalResponse: %v", err) -// } -// -// expected := "{\"signatureEnvelope\":\"ZW52ZWxvcGU=\",\"signatureEnvelopeType\":\"envelopeType\",\"annotations\":{\"key\":\"value\"}}" -// if !strings.EqualFold("{\"signatureEnvelope\":\"ZW52ZWxvcGU=\",\"signatureEnvelopeType\":\"envelopeType\",\"annotations\":{\"key\":\"value\"}}", op) { -// t.Errorf("Not equal: \n expected: %s\n actual : %s", expected, op) -// } -//} - func assertErr(t *testing.T, err error, code plugin.Code) { if plgErr, ok := err.(*plugin.Error); ok { if reflect.DeepEqual(code, plgErr.ErrCode) {