From bc1a7dc30c4f1729d23bf028f44e35f74ed7d7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Wed, 9 Jun 2021 19:49:31 +0200 Subject: [PATCH] tests: fix journalctl killing once again MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3a8c6c8a introduced a new logic for killing journalctl. Unfortunately, it doesn't work properly. In ostree tests, multiple journalctls are spawned but there can be only one trap active at a time. This caused all but the last journalctls to hang indefinitely. Unfortunately, hanging background processes is something that causes the GitLab CI to hang indefinitely as well. This commit modifies the logic a bit: The trap is still set. However, there's also an explicit kill of journalctl after the compose is finished. After the process is successfully killed, the trap is removed. Signed-off-by: OndΕ™ej Budai --- test/cases/aws.sh | 4 ++++ test/cases/azure.sh | 4 ++++ test/cases/ostree-ng.sh | 4 ++++ test/cases/ostree.sh | 4 ++++ test/cases/vmware.sh | 4 ++++ tools/libvirt_test.sh | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/test/cases/aws.sh b/test/cases/aws.sh index d4ca5d6ca..8d3eccd80 100755 --- a/test/cases/aws.sh +++ b/test/cases/aws.sh @@ -159,6 +159,10 @@ greenprint "πŸ’¬ Getting compose log and metadata" get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" +# Kill the journal monitor immediately and remove the trap +sudo pkill -P ${WORKER_JOURNAL_PID} +trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒" diff --git a/test/cases/azure.sh b/test/cases/azure.sh index b6ea55c81..97388a901 100755 --- a/test/cases/azure.sh +++ b/test/cases/azure.sh @@ -178,6 +178,10 @@ greenprint "πŸ’¬ Getting compose log and metadata" get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" +# Kill the journal monitor immediately and remove the trap +sudo pkill -P ${WORKER_JOURNAL_PID} +trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒" diff --git a/test/cases/ostree-ng.sh b/test/cases/ostree-ng.sh index f3b720ef6..87eb66cd1 100755 --- a/test/cases/ostree-ng.sh +++ b/test/cases/ostree-ng.sh @@ -152,6 +152,10 @@ build_image() { get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" + # Kill the journal monitor immediately and remove the trap + sudo pkill -P ${WORKER_JOURNAL_PID} + trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒" diff --git a/test/cases/ostree.sh b/test/cases/ostree.sh index 6c6a81e05..9dff22e0f 100755 --- a/test/cases/ostree.sh +++ b/test/cases/ostree.sh @@ -184,6 +184,10 @@ build_image() { get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" + # Kill the journal monitor immediately and remove the trap + sudo pkill -P ${WORKER_JOURNAL_PID} + trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒" diff --git a/test/cases/vmware.sh b/test/cases/vmware.sh index b7ad46457..94d6e4bee 100755 --- a/test/cases/vmware.sh +++ b/test/cases/vmware.sh @@ -160,6 +160,10 @@ greenprint "πŸ’¬ Getting compose log and metadata" get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" +# Kill the journal monitor immediately and remove the trap +sudo pkill -P ${WORKER_JOURNAL_PID} +trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒" diff --git a/tools/libvirt_test.sh b/tools/libvirt_test.sh index a20826c5f..bfe9166c7 100755 --- a/tools/libvirt_test.sh +++ b/tools/libvirt_test.sh @@ -166,6 +166,10 @@ greenprint "πŸ’¬ Getting compose log and metadata" get_compose_log "$COMPOSE_ID" get_compose_metadata "$COMPOSE_ID" +# Kill the journal monitor immediately and remove the trap +sudo pkill -P ${WORKER_JOURNAL_PID} +trap - EXIT + # Did the compose finish with success? if [[ $COMPOSE_STATUS != FINISHED ]]; then echo "Something went wrong with the compose. 😒"