Merge pull request #9349 from fuweid/deflaky-TestIssue9103
integration: deflake TestIssue9103
This commit is contained in:
commit
c2b39b139e
@ -1447,6 +1447,7 @@ func TestIssue9103(t *testing.T) {
|
|||||||
for idx, tc := range []struct {
|
for idx, tc := range []struct {
|
||||||
desc string
|
desc string
|
||||||
cntrOpts []NewContainerOpts
|
cntrOpts []NewContainerOpts
|
||||||
|
bakingFn func(ctx context.Context, t *testing.T, task Task)
|
||||||
expectedStatus ProcessStatus
|
expectedStatus ProcessStatus
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
@ -1456,6 +1457,7 @@ func TestIssue9103(t *testing.T) {
|
|||||||
withProcessArgs("sleep", "30"),
|
withProcessArgs("sleep", "30"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
bakingFn: func(context.Context, *testing.T, Task) {},
|
||||||
expectedStatus: Created,
|
expectedStatus: Created,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1471,6 +1473,17 @@ func TestIssue9103(t *testing.T) {
|
|||||||
BinaryName: "runc-fp",
|
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,
|
expectedStatus: Stopped,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
@ -1490,6 +1503,8 @@ func TestIssue9103(t *testing.T) {
|
|||||||
|
|
||||||
defer task.Delete(ctx, WithProcessKill)
|
defer task.Delete(ctx, WithProcessKill)
|
||||||
|
|
||||||
|
tc.bakingFn(ctx, t, task)
|
||||||
|
|
||||||
status, err := task.Status(ctx)
|
status, err := task.Status(ctx)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, tc.expectedStatus, status.Status)
|
require.Equal(t, tc.expectedStatus, status.Status)
|
||||||
|
Loading…
Reference in New Issue
Block a user