Skip to content

Commit

Permalink
integration: deflake TestIssue9103
Browse files Browse the repository at this point in the history
Fixes: containerd#9334

Signed-off-by: Wei Fu <fuweid89@gmail.com>
  • Loading branch information
fuweid committed Nov 8, 2023
1 parent 5149050 commit dac056f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions integration/client/container_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,7 @@ func TestIssue9103(t *testing.T) {
for idx, tc := range []struct {
desc string
cntrOpts []NewContainerOpts
bakingFn func(ctx context.Context, t *testing.T, task Task)
expectedStatus ProcessStatus
}{
{
Expand All @@ -1456,6 +1457,7 @@ func TestIssue9103(t *testing.T) {
withProcessArgs("sleep", "30"),
),
},
bakingFn: func(context.Context, *testing.T, Task) {},
expectedStatus: Created,
},
{
Expand All @@ -1471,6 +1473,17 @@ func TestIssue9103(t *testing.T) {
BinaryName: "runc-fp",
}),
},
bakingFn: func(ctx context.Context, t *testing.T, task Task) {
waitCh, err := task.Wait(ctx)
require.NoError(t, err)

select {
case <-time.After(30 * time.Second):
t.Fatal("timeout")
case e := <-waitCh:
require.NoError(t, e.Error())
}
},
expectedStatus: Stopped,
},
} {
Expand All @@ -1490,6 +1503,8 @@ func TestIssue9103(t *testing.T) {

defer task.Delete(ctx, WithProcessKill)

tc.bakingFn(ctx, t, task)

status, err := task.Status(ctx)
require.NoError(t, err)
require.Equal(t, tc.expectedStatus, status.Status)
Expand Down

0 comments on commit dac056f

Please sign in to comment.