mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #48417 from adams1mon/try-fix-flaky-plugin-client-test
Increase flaky test sleep, replace deprecated assert
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user