containerd/integration
Wei Fu 9e9ee66bfd integration: deflake TestContainerdRestart
The CRI-plugin will setup watcher for each container after
StartContainer or RunPodSandbox. It will cleanup task(container/sandbox)
if received the exit event from watcher.

The original test design is to `Delete` sandbox container to get
NOT_READY state and expect to receive NotFound error. It depends on that
CRI-plugin cleanups container after `Delete` API. If not, the shim will
be cleanup and test code will receive `ttrpc: closed: unknown` or other
unknown error. It is flaky.

In this patch, the test will only send the kill signal and wait for the
exit event. When sandbox exits, the state will and must be NOT_READY.

```plain
// test fail log

=== RUN TestContainerdRestart
restart_test.go:92: Make sure no sandbox is running before test
restart_test.go:97: Start test sandboxes and containers
common.go:115: Image "k8s.gcr.io/pause:3.6" already exists, not pulling.
common.go:115: Image "k8s.gcr.io/pause:3.6" already exists, not pulling.
restart_test.go:139:
Error Trace: restart_test.go:139
Error: Should be true
Test: TestContainerdRestart
Messages: delete should return not found error but returned failed to delete task: ttrpc: closed: unknown
--- FAIL: TestContainerdRestart (4.25s)

// containerd log

&TaskExit{ContainerID:4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184,ID:4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184,Pid:28430,ExitStatus:137,ExitedAt:2021-12-12 07:56:01.400753012 +0000 UTC,XXX_unrecognized:[],}"
time="2021-12-12T07:56:01.401120516Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/exit type=containerd.events.TaskExit
time="2021-12-12T07:56:01.418934208Z" level=debug msg="event forwarded" ns=k8s.io topic=/tasks/delete type=containerd.events.TaskDelete
time="2021-12-12T07:56:01.419192910Z" level=info msg="shim disconnected" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184
time="2021-12-12T07:56:01.419235911Z" level=warning msg="cleaning up after shim disconnected" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184 namespace=k8s.io
time="2021-12-12T07:56:01.419247711Z" level=info msg="cleaning up dead shim"
time="2021-12-12T07:56:01.419235311Z" level=error msg="failed sending message on channel" error="write unix /run/containerd/s/18afde7fcde70236eb31b9f43f3bd92af1dc1186583c501aa1396255f87f95d4->@: write: broken pipe"
time="2021-12-12T07:56:01.419354712Z" level=debug msg="failed to delete task" error="ttrpc: closed" id=4b4c1d1d303c14a2cc759631d163f153ba8536e9ea6821744a509e4a17346184
```

CI Link: `https://pipelines.actions.githubusercontent.com/G4SighzWVVZ6vsyiz7FFMFjLjRzveJHseEnVyibkSq87Cl2x4O/_apis/pipelines/1/runs/9501/signedlogcontent/76?urlExpires=2021-12-12T08%3A42%3A08.0765750Z&urlSigningMethod=HMACV1&urlSignature=pH93isMSFdZUo1ndnZynJpZbPGrEyvt12MO03fgUU7I%3D`

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-12-13 23:43:26 +08:00
..
client Disable restart monitor test in Windows 2021-12-10 11:43:23 -08:00
cri-api/pkg/apis feat: enable cri remote client to call with grpc calloptions 2021-09-30 23:02:53 +08:00
images Use a single RUN command 2021-12-03 18:10:39 +02:00
remote Merge pull request #5973 from Juneezee/deprecate-ioutil 2021-10-01 10:52:06 -07:00
util refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
addition_gids_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
common.go integration: align tags of test images 2021-12-03 15:14:09 +01:00
container_log_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
container_restart_test.go test integration: Adds a test that restarts a failed container 2021-06-25 10:33:38 +00:00
container_stats_test.go integration: add stats result in error message 2021-11-28 16:57:40 +08:00
container_stop_test.go Merge pull request #5619 from mikebrow/cri-add-v1-proxy-alpha 2021-07-09 14:07:24 -04:00
container_update_resources_test.go Adds Windows resource limits support 2021-09-25 13:20:55 -07:00
container_volume_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
container_without_image_ref_test.go Merge pull request #5619 from mikebrow/cri-add-v1-proxy-alpha 2021-07-09 14:07:24 -04:00
containerd_image_test.go Additional integration tests for pulling image with labels 2021-09-10 20:16:57 +08:00
duplicate_name_test.go tests: Refactors PodSandbox creation 2021-06-03 16:02:38 +00:00
image_list.sample.toml integration: align tags of test images 2021-12-03 15:14:09 +01:00
image_load_test.go Fix wrong make target on documentation 2021-11-23 03:42:08 +09:00
imagefs_info_test.go Merge pull request #5619 from mikebrow/cri-add-v1-proxy-alpha 2021-07-09 14:07:24 -04:00
main_test.go Merge pull request #5579 from claudiubelu/integration/restart-containerd 2021-10-08 10:33:10 -07:00
no_metadata_test.go Merge pull request #5619 from mikebrow/cri-add-v1-proxy-alpha 2021-07-09 14:07:24 -04:00
pod_dualstack_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
pod_hostname_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
restart_test.go integration: deflake TestContainerdRestart 2021-12-13 23:43:26 +08:00
runtime_handler_test.go integration: Enables TestRuntimeHandler for Windows 2021-10-07 18:20:59 -07:00
sandbox_clean_remove_test.go refactor: move from io/ioutil to io and os package 2021-09-21 09:50:38 +08:00
shim_dial_unix_test.go io/ioutil package has been deprecated in Go 1.16 that replaces io/ioutil functions 2021-10-13 09:18:31 +08:00
truncindex_test.go Adds Windows resource limits support 2021-09-25 13:20:55 -07:00
volume_copy_up_test.go integration: align tags of test images 2021-12-03 15:14:09 +01:00
windows_hostprocess_test.go integration: Adds Windows HostProcess tests 2021-09-07 00:30:28 -07:00