| From: Miri Amarilio <mirilio@google.com> |
| Date: Thu, 15 Feb 2024 15:27:00 +0000 |
| Subject: [PATCH] Add sleep time in TestContainerPids after creating the new task to let the task fully start (and start the inf sleep process inside the container). |
| |
| In some cases the test will fail with the error of finding only 1 pid when expecting 2. This means that the sleep process did not exist yet when querying for container pids. |
| The resolution is to wait after creating the sleep process and before querying for pids. |
| |
| diff --git a/integration/client/container_test.go b/integration/client/container_test.go |
| index ba41e04..fb5e7c7 100644 |
| --- a/integration/client/container_test.go |
| +++ b/integration/client/container_test.go |
| @@ -565,6 +565,8 @@ func TestContainerPids(t *testing.T) { |
| if err := task.Start(ctx); err != nil { |
| t.Fatal(err) |
| } |
| + // Sleep to let the task fully start (the task starts an infinite sleep in the container in order to add another process) |
| + time.Sleep(5 * time.Second) |
| |
| taskPid := task.Pid() |
| if taskPid < 1 { |