Skip to content

Commit

Permalink
Fix CSI mock driver to get marshaleable grpc error
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed Jun 15, 2021
1 parent 77ab4bd commit 1134456
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/e2e/storage/drivers/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ import (
"time"

"github.com/onsi/ginkgo"
spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes"
grpcstatus "google.golang.org/grpc/status"

appsv1 "k8s.io/api/apps/v1"
v1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
Expand Down Expand Up @@ -405,16 +408,16 @@ func (c *MockCSICalls) LogGRPC(method string, request, reply interface{}, err er
// "" on no error.
Error string
// Full error dump, to be able to parse out full gRPC error code and message separately in a test.
FullError error
FullError *spb.Status
}{
Method: method,
Request: request,
Response: reply,
FullError: err,
Method: method,
Request: request,
Response: reply,
}

if err != nil {
logMessage.Error = err.Error()
logMessage.FullError = grpcstatus.Convert(err).Proto()
}

msg, _ := json.Marshal(logMessage)
Expand Down

0 comments on commit 1134456

Please sign in to comment.