diff --git a/pkg/plugins/client_test.go b/pkg/plugins/client_test.go index a284249df19f6..a7e3ff419cc14 100644 --- a/pkg/plugins/client_test.go +++ b/pkg/plugins/client_test.go @@ -9,7 +9,6 @@ import ( "net/http" "net/http/httptest" "net/url" - "os" "strings" "testing" "time" @@ -169,15 +168,21 @@ func TestNewClientWithTimeout(t *testing.T) { m := Manifest{[]string{"VolumeDriver", "NetworkDriver"}} mux.HandleFunc("/Test.Echo", func(w http.ResponseWriter, r *http.Request) { - time.Sleep(20 * time.Millisecond) + time.Sleep(50 * time.Millisecond) io.Copy(w, r.Body) }) timeout := 10 * time.Millisecond c, _ := NewClientWithTimeout(addr, &tlsconfig.Options{InsecureSkipVerify: true}, timeout) var output Manifest + err := c.CallWithOptions("Test.Echo", m, &output, func(opts *RequestOpts) { opts.testTimeOut = 1 }) - assert.ErrorType(t, err, os.IsTimeout) + var tErr interface { + Timeout() bool + } + if assert.Check(t, errors.As(err, &tErr), "want timeout error, got %T", err) { + assert.Check(t, tErr.Timeout()) + } } func TestClientStream(t *testing.T) {