mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Fix CSI mock driver to get marshaleable grpc error
This commit is contained in:
parent
77ab4bdbbc
commit
1134456c89
@ -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"
|
||||
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user