diff options
author | Yuxuan 'fishy' Wang <yuxuan.wang@reddit.com> | 2022-05-19 11:09:01 -0700 |
---|---|---|
committer | Yuxuan 'fishy' Wang <fishywang@gmail.com> | 2022-05-21 10:08:32 -0700 |
commit | 162cbb4894548ac4d016f8e63a15f994b17c4dba (patch) | |
tree | f28429e31a2fd9c6c40be4790170a9f2d3bf1565 /lib/go/thrift/simple_server_test.go | |
parent | c4e96c75758d94a79dae925b1daae0c950823057 (diff) | |
download | thrift-162cbb4894548ac4d016f8e63a15f994b17c4dba.tar.gz |
Minor tweak to ErrAbandonRequest in go library
Client: go
Make it unwrap to context.Canceled, since the main use case of it is to
be returned in lieu of context.Canceled to avoid extra writing to the
client, so that if user has any processor middleware that checks for
context.Canceled error those would still work.
Diffstat (limited to 'lib/go/thrift/simple_server_test.go')
-rw-r--r-- | lib/go/thrift/simple_server_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/go/thrift/simple_server_test.go b/lib/go/thrift/simple_server_test.go index b92d50f01..e0cf151b9 100644 --- a/lib/go/thrift/simple_server_test.go +++ b/lib/go/thrift/simple_server_test.go @@ -287,3 +287,15 @@ func TestStopTimeoutWithSocketTimeout(t *testing.T) { t.Fatalf("error when stop server:%v", err) } } + +func TestErrAbandonRequest(t *testing.T) { + if !errors.Is(ErrAbandonRequest, ErrAbandonRequest) { + t.Error("errors.Is(ErrAbandonRequest, ErrAbandonRequest) returned false") + } + if !errors.Is(ErrAbandonRequest, context.Canceled) { + t.Error("errors.Is(ErrAbandonRequest, context.Canceled) returned false") + } + if errors.Is(context.Canceled, ErrAbandonRequest) { + t.Error("errors.Is(context.Canceled, ErrAbandonRequest) returned true") + } +} |