Skip to content

Commit

Permalink
Merge pull request moby#48417 from adams1mon/try-fix-flaky-plugin-cli…
Browse files Browse the repository at this point in the history
…ent-test

Increase flaky test sleep, replace deprecated assert
  • Loading branch information
vvoland authored Oct 22, 2024
2 parents d99294e + 28dc2f6 commit 11aa9e1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/plugins/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"net/http"
"net/http/httptest"
"net/url"
"os"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 11aa9e1

Please sign in to comment.