diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-12 13:34:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 13:34:27 +0000 |
commit | 5b22ddd08ebac4f22cf745131e3fba09b3d995d2 (patch) | |
tree | bff561762f412194c857eea0b2b25bc54ca2c219 /test | |
parent | 81737b37738dfa21be3cf9775919458523511ae9 (diff) | |
parent | 660a72993c425d9242641a846596b5ca33d6368f (diff) | |
download | podman-5b22ddd08ebac4f22cf745131e3fba09b3d995d2.tar.gz podman-5b22ddd08ebac4f22cf745131e3fba09b3d995d2.tar.bz2 podman-5b22ddd08ebac4f22cf745131e3fba09b3d995d2.zip |
Merge pull request #9697 from edsantiago/fedora_gating_test_hang
sdnotify tests: try real hard to kill socat processes
Diffstat (limited to 'test')
-rw-r--r-- | test/system/260-sdnotify.bats | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/system/260-sdnotify.bats b/test/system/260-sdnotify.bats index a5fa0f4e6..8bf49eb1d 100644 --- a/test/system/260-sdnotify.bats +++ b/test/system/260-sdnotify.bats @@ -42,14 +42,22 @@ function _start_socat() { _SOCAT_LOG="$PODMAN_TMPDIR/socat.log" rm -f $_SOCAT_LOG - socat unix-recvfrom:"$NOTIFY_SOCKET",fork \ - system:"(cat;echo) >> $_SOCAT_LOG" & + # Execute in subshell so we can close fd3 (which BATS uses). + # This is a superstitious ritual to try to avoid leaving processes behind, + # and thus prevent CI hangs. + (exec socat unix-recvfrom:"$NOTIFY_SOCKET",fork \ + system:"(cat;echo) >> $_SOCAT_LOG" 3>&-) & _SOCAT_PID=$! } # Stop the socat background process and clean up logs function _stop_socat() { if [[ -n "$_SOCAT_PID" ]]; then + # Kill all child processes, then the process itself. + # This is a superstitious incantation to avoid leaving processes behind. + # The '|| true' is because only f35 leaves behind socat processes; + # f33 (and perhaps others?) behave nicely. ARGH! + pkill -P $_SOCAT_PID || true kill $_SOCAT_PID fi _SOCAT_PID= @@ -57,6 +65,7 @@ function _stop_socat() { if [[ -n "$_SOCAT_LOG" ]]; then rm -f $_SOCAT_LOG fi + _SOCAT_LOG= } # Check that MAINPID=xxxxx points to a running conmon process |