Skip to content

Commit dac056f

Browse files
committed
integration: deflake TestIssue9103
Fixes: containerd#9334 Signed-off-by: Wei Fu <[email protected]>
1 parent 5149050 commit dac056f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

integration/client/container_linux_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@ func TestIssue9103(t *testing.T) {
14471447
for idx, tc := range []struct {
14481448
desc string
14491449
cntrOpts []NewContainerOpts
1450+
bakingFn func(ctx context.Context, t *testing.T, task Task)
14501451
expectedStatus ProcessStatus
14511452
}{
14521453
{
@@ -1456,6 +1457,7 @@ func TestIssue9103(t *testing.T) {
14561457
withProcessArgs("sleep", "30"),
14571458
),
14581459
},
1460+
bakingFn: func(context.Context, *testing.T, Task) {},
14591461
expectedStatus: Created,
14601462
},
14611463
{
@@ -1471,6 +1473,17 @@ func TestIssue9103(t *testing.T) {
14711473
BinaryName: "runc-fp",
14721474
}),
14731475
},
1476+
bakingFn: func(ctx context.Context, t *testing.T, task Task) {
1477+
waitCh, err := task.Wait(ctx)
1478+
require.NoError(t, err)
1479+
1480+
select {
1481+
case <-time.After(30 * time.Second):
1482+
t.Fatal("timeout")
1483+
case e := <-waitCh:
1484+
require.NoError(t, e.Error())
1485+
}
1486+
},
14741487
expectedStatus: Stopped,
14751488
},
14761489
} {
@@ -1490,6 +1503,8 @@ func TestIssue9103(t *testing.T) {
14901503

14911504
defer task.Delete(ctx, WithProcessKill)
14921505

1506+
tc.bakingFn(ctx, t, task)
1507+
14931508
status, err := task.Status(ctx)
14941509
require.NoError(t, err)
14951510
require.Equal(t, tc.expectedStatus, status.Status)

0 commit comments

Comments
 (0)