1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

integration-cli: fix pollCheck

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2019-09-09 20:49:16 +00:00
parent bad6f3bf73
commit 8eb9f3f90e

View file

@ -20,6 +20,7 @@ import (
"github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/daemon"
"gotest.tools/assert"
"gotest.tools/assert/cmp"
"gotest.tools/icmd"
"gotest.tools/poll"
)
@ -441,8 +442,18 @@ func pollCheck(t *testing.T, f checkF, compare func(x interface{}) assert.BoolOr
return func(poll.LogT) poll.Result {
t.Helper()
v, comment := f(t)
if assert.Check(t, compare(v)) {
return poll.Success()
r := compare(v)
switch r := r.(type) {
case bool:
if r {
return poll.Success()
}
case cmp.Comparison:
if r().Success() {
return poll.Success()
}
default:
panic(fmt.Errorf("pollCheck: type %T not implemented", r))
}
return poll.Continue(comment)
}