From 8eb9f3f90ebca83c500c1e60857a834fc1ea7e8a Mon Sep 17 00:00:00 2001 From: Tibor Vass Date: Mon, 9 Sep 2019 20:49:16 +0000 Subject: [PATCH] integration-cli: fix pollCheck Signed-off-by: Tibor Vass --- integration-cli/docker_utils_test.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/integration-cli/docker_utils_test.go b/integration-cli/docker_utils_test.go index 739bf03fea..e70e91a418 100644 --- a/integration-cli/docker_utils_test.go +++ b/integration-cli/docker_utils_test.go @@ -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) }