From ef08ebff30f9151fc344906de91af24f3f4defbc Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 20 Oct 2025 22:23:58 -0700 Subject: [PATCH] fix(ci): dump server/container logs when tests fail Output last 100 lines of server.log or docker container logs when integration tests fail to aid debugging. --- scripts/integration-tests.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index 99db89742..433914967 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -410,6 +410,21 @@ elif [ $exit_code -eq 5 ]; then echo "⚠️ No tests collected (pattern matched no tests)" else echo "❌ Tests failed" + echo "" + echo "=== Dumping last 100 lines of logs for debugging ===" + + # Output server or container logs based on stack config + if [[ "$STACK_CONFIG" == *"server:"* && -f "server.log" ]]; then + echo "--- Last 100 lines of server.log ---" + tail -100 server.log + elif [[ "$STACK_CONFIG" == *"docker:"* ]]; then + container_name="llama-stack-test-$DISTRO" + if docker ps -a --format '{{.Names}}' | grep -q "^${container_name}$"; then + echo "--- Last 100 lines of docker logs for $container_name ---" + docker logs "$container_name" 2>&1 | tail -100 + fi + fi + exit 1 fi