Use poll.WaitOn in authz_plugin_test.go

This fix uses poll.WaitOn to replace customerized
implementation in authz_plugin_test.go

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit 0492b0997b2fc739a9a6fe6831145297d8149e55)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: cdb40114b4b50bb86e03210186823895e4454653
Component: engine
This commit is contained in:
Yong Tang
2019-04-17 23:08:49 +02:00
committed by Sebastiaan van Stijn
parent a6c15caac6
commit 0e40cd84ba
@@ -26,6 +26,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/authorization"
"gotest.tools/assert"
"gotest.tools/poll"
"gotest.tools/skip"
)
@@ -224,18 +225,7 @@ func TestAuthZPluginAllowEventStream(t *testing.T) {
// Create a container and wait for the creation events
cID := container.Run(t, ctx, c)
for i := 0; i < 100; i++ {
c, err := c.ContainerInspect(ctx, cID)
assert.NilError(t, err)
if c.State.Running {
break
}
if i == 99 {
t.Fatal("Container didn't run within 10s")
}
time.Sleep(100 * time.Millisecond)
}
poll.WaitOn(t, container.IsInState(ctx, c, cID, "running"))
created := false
started := false