Skip to content

Commit b2c73c6

Browse files
committed
[chore] Pull systemd service logs on package test failure
1 parent f80d8df commit b2c73c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/package-tests/package-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ podman run --name "$container_name" -d "$image_name"
5050
$container_exec systemctl is-system-running --quiet --wait
5151
install_pkg "$container_name" "$PKG_PATH"
5252

53+
# If we got to this point, we might need to check the logs of the systemd service
54+
# when it's not properly active. This is added as a trap because the check
55+
# for service status below will return an error exitcode if the service is
56+
# not active, triggering the end of this script because of the shell option `-e`
57+
trap '$container_exec journalctl -u "$SERVICE_NAME" || true' EXIT
58+
5359
# ensure service has started and still running after 5 seconds
5460
sleep 5
5561
echo "Checking $SERVICE_NAME service status ..."

0 commit comments

Comments
 (0)