Skip to content

Commit

Permalink
CR feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Pritesh Bandi <[email protected]>
  • Loading branch information
priteshbandi committed Aug 21, 2023
1 parent 02bc34d commit bb55b5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
4 changes: 2 additions & 2 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
21 changes: 0 additions & 21 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bb55b5a

Please sign in to comment.