moby--moby/integration/container
Brian Goff acb4f263b3
Fix racey TestHealthKillContainer
Before this change if you assume that things work the way the test
expects them to (it does not, but lets assume for now) we aren't really
testing anything because we are testing that a container is healthy
before and after we send a signal. This will give false positives even
if there is a bug in the underlying code. Sending a signal can take any
amount of time to cause a container to exit or to trigger healthchecks
to stop or whatever.

Now lets remove the assumption that things are working as expected,
because they are not.
In this case, `top` (which is what is running in the container) is
actually exiting when it receives `USR1`.
This totally invalidates the test.

We need more control and knowledge as to what is happening in the
container to properly test this.
This change introduces a custom script which traps `USR1` and flips the
health status each time the signal is received.
We then send the signal twice so that we know the change has occurred
and check that the value has flipped so that we know the change has
actually occurred.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 27ba755f70)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-10-22 09:30:08 +02:00
..
checkpoint_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
container_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
copy_test.go Windows: Enable more integration tests 2020-09-20 22:09:27 +03:00
create_test.go Don't set default platform on container create 2020-10-20 20:17:23 +00:00
daemon_linux_test.go Make test work with rootless mode 2021-02-03 13:54:09 +01:00
daemon_test.go On startup, actually shutdown the container. 2020-04-13 14:20:12 -07:00
diff_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
exec_test.go Windows: Enable more integration tests 2020-09-20 22:09:27 +03:00
export_test.go Using test names instead of hardcoded ones in integration/container directory 2020-05-18 16:37:04 +01:00
health_test.go Fix racey TestHealthKillContainer 2021-10-22 09:30:08 +02:00
inspect_test.go Using test names instead of hardcoded ones in integration/container directory 2020-05-18 16:37:04 +01:00
ipcmode_linux_test.go Merge pull request #40725 from cpuguy83/check_img_platform 2020-05-21 11:33:27 -07:00
kill_test.go TestInspectOomKilledTrue: skip on cgroup v2 2021-02-16 09:22:27 +01:00
links_linux_test.go hack: support $DOCKER_ROOTLESS for testing rootless 2020-03-10 05:49:45 +09:00
logs_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
main_test.go
mounts_linux_test.go Rewrite VolumesMountedAsShared/Slave as Integration tests 2020-11-08 23:15:15 +11:00
nat_test.go integration: update getExternalAddress to prefer IPv4 2021-03-24 22:04:08 +01:00
pause_test.go hack: support $DOCKER_ROOTLESS for testing rootless 2020-03-10 05:49:45 +09:00
ps_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
remove_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
rename_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
resize_test.go Windows: Enable more integration tests 2020-09-20 22:09:27 +03:00
restart_test.go Merge pull request #40725 from cpuguy83/check_img_platform 2020-05-21 11:33:27 -07:00
run_cgroupns_linux_test.go TestCgroupNamespacesRunOlderClient: support cgroup v2 2021-02-02 14:34:08 +09:00
run_linux_test.go integration: remove KernelMemory tests 2021-05-18 09:25:38 +02:00
stats_test.go Merge pull request #40478 from cpuguy83/dont-prime-the-stats 2020-04-16 20:57:06 +02:00
stop_linux_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
stop_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
stop_windows_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
update_linux_test.go test-integration: support cgroup2 2020-06-22 14:17:45 +09:00
update_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00
wait_test.go bump gotest.tools v3.0.1 for compatibility with Go 1.14 2020-02-11 00:06:42 +01:00