@@ -11,6 +11,7 @@ import (
1111 "os/exec"
1212 "path/filepath"
1313 "reflect"
14+ "regexp"
1415 "runtime"
1516 "strings"
1617 "sync"
@@ -47,6 +48,8 @@ type Member struct {
4748 Val uint
4849}
4950
51+ var contextDoneErrRegexp = regexp .MustCompile (`^context is done \(request ID [0-9]+\)$` )
52+
5053func (m * Member ) EncodeMsgpack (e * msgpack.Encoder ) error {
5154 if err := e .EncodeArrayLen (2 ); err != nil {
5255 return err
@@ -2731,7 +2734,7 @@ func TestClientRequestObjectsWithPassedCanceledContext(t *testing.T) {
27312734 req := NewPingRequest ().Context (ctx )
27322735 cancel ()
27332736 resp , err := conn .Do (req ).Get ()
2734- if err .Error () != "context is done" {
2737+ if ! contextDoneErrRegexp . Match ([] byte ( err .Error ())) {
27352738 t .Fatalf ("Failed to catch an error from done context" )
27362739 }
27372740 if resp != nil {
@@ -2802,7 +2805,7 @@ func TestClientRequestObjectsWithContext(t *testing.T) {
28022805 if err == nil {
28032806 t .Fatalf ("caught nil error" )
28042807 }
2805- if err .Error () != "context is done" {
2808+ if ! contextDoneErrRegexp . Match ([] byte ( err .Error ())) {
28062809 t .Fatalf ("wrong error caught: %v" , err )
28072810 }
28082811}
@@ -3295,7 +3298,7 @@ func TestClientIdRequestObjectWithPassedCanceledContext(t *testing.T) {
32953298 resp , err := conn .Do (req ).Get ()
32963299 require .Nilf (t , resp , "Response is empty" )
32973300 require .NotNilf (t , err , "Error is not empty" )
3298- require .Equal (t , err .Error (), "context is done" )
3301+ require .Regexp (t , contextDoneErrRegexp , err .Error ())
32993302}
33003303
33013304func TestConnectionProtocolInfoUnsupported (t * testing.T ) {
0 commit comments