mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +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"
|
"time"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
|
spb "google.golang.org/genproto/googleapis/rpc/status"
|
||||||
"google.golang.org/grpc/codes"
|
"google.golang.org/grpc/codes"
|
||||||
|
grpcstatus "google.golang.org/grpc/status"
|
||||||
|
|
||||||
appsv1 "k8s.io/api/apps/v1"
|
appsv1 "k8s.io/api/apps/v1"
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
rbacv1 "k8s.io/api/rbac/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.
|
// "" on no error.
|
||||||
Error string
|
Error string
|
||||||
// Full error dump, to be able to parse out full gRPC error code and message separately in a test.
|
// 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,
|
Method: method,
|
||||||
Request: request,
|
Request: request,
|
||||||
Response: reply,
|
Response: reply,
|
||||||
FullError: err,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logMessage.Error = err.Error()
|
logMessage.Error = err.Error()
|
||||||
|
logMessage.FullError = grpcstatus.Convert(err).Proto()
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, _ := json.Marshal(logMessage)
|
msg, _ := json.Marshal(logMessage)
|
||||||
|
Loading…
Reference in New Issue
Block a user