Add support to gRPC errdefs for context cancel/deadline exceeded
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package errdefs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
@@ -56,6 +57,26 @@ func TestGRPCRoundTrip(t *testing.T) {
|
||||
cause: ErrUnknown,
|
||||
str: errShouldLeaveAlone.Error() + ": " + ErrUnknown.Error(),
|
||||
},
|
||||
{
|
||||
input: context.Canceled,
|
||||
cause: context.Canceled,
|
||||
str: "context canceled",
|
||||
},
|
||||
{
|
||||
input: errors.Wrapf(context.Canceled, "this is a test cancel"),
|
||||
cause: context.Canceled,
|
||||
str: "this is a test cancel: context canceled",
|
||||
},
|
||||
{
|
||||
input: context.DeadlineExceeded,
|
||||
cause: context.DeadlineExceeded,
|
||||
str: "context deadline exceeded",
|
||||
},
|
||||
{
|
||||
input: errors.Wrapf(context.DeadlineExceeded, "this is a test deadline exceeded"),
|
||||
cause: context.DeadlineExceeded,
|
||||
str: "this is a test deadline exceeded: context deadline exceeded",
|
||||
},
|
||||
} {
|
||||
t.Run(testcase.input.Error(), func(t *testing.T) {
|
||||
t.Logf("input: %v", testcase.input)
|
||||
|
Reference in New Issue
Block a user