Browse code

integration-cli: fix pollCheck

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2019/09/10 05:49:16
Showing 1 changed files
... ...
@@ -20,6 +20,7 @@ import (
20 20
 	"github.com/docker/docker/integration-cli/cli"
21 21
 	"github.com/docker/docker/integration-cli/daemon"
22 22
 	"gotest.tools/assert"
23
+	"gotest.tools/assert/cmp"
23 24
 	"gotest.tools/icmd"
24 25
 	"gotest.tools/poll"
25 26
 )
... ...
@@ -441,8 +442,18 @@ func pollCheck(t *testing.T, f checkF, compare func(x interface{}) assert.BoolOr
441 441
 	return func(poll.LogT) poll.Result {
442 442
 		t.Helper()
443 443
 		v, comment := f(t)
444
-		if assert.Check(t, compare(v)) {
445
-			return poll.Success()
444
+		r := compare(v)
445
+		switch r := r.(type) {
446
+		case bool:
447
+			if r {
448
+				return poll.Success()
449
+			}
450
+		case cmp.Comparison:
451
+			if r().Success() {
452
+				return poll.Success()
453
+			}
454
+		default:
455
+			panic(fmt.Errorf("pollCheck: type %T not implemented", r))
446 456
 		}
447 457
 		return poll.Continue(comment)
448 458
 	}