This fix uses poll.WaitOn to replace customerized
implementation in authz_plugin_test.go
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -26,6 +26,7 @@ import ( |
| 26 | 26 |
"github.com/docker/docker/pkg/archive" |
| 27 | 27 |
"github.com/docker/docker/pkg/authorization" |
| 28 | 28 |
"gotest.tools/assert" |
| 29 |
+ "gotest.tools/poll" |
|
| 29 | 30 |
"gotest.tools/skip" |
| 30 | 31 |
) |
| 31 | 32 |
|
| ... | ... |
@@ -224,18 +225,7 @@ func TestAuthZPluginAllowEventStream(t *testing.T) {
|
| 224 | 224 |
|
| 225 | 225 |
// Create a container and wait for the creation events |
| 226 | 226 |
cID := container.Run(t, ctx, c) |
| 227 |
- |
|
| 228 |
- for i := 0; i < 100; i++ {
|
|
| 229 |
- c, err := c.ContainerInspect(ctx, cID) |
|
| 230 |
- assert.NilError(t, err) |
|
| 231 |
- if c.State.Running {
|
|
| 232 |
- break |
|
| 233 |
- } |
|
| 234 |
- if i == 99 {
|
|
| 235 |
- t.Fatal("Container didn't run within 10s")
|
|
| 236 |
- } |
|
| 237 |
- time.Sleep(100 * time.Millisecond) |
|
| 238 |
- } |
|
| 227 |
+ poll.WaitOn(t, container.IsInState(ctx, c, cID, "running")) |
|
| 239 | 228 |
|
| 240 | 229 |
created := false |
| 241 | 230 |
started := false |