From 7799ced1486cca45ac598b1abab1be7649f76346 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Thu, 14 Dec 2023 09:25:55 +0100
Subject: [PATCH] remove empty logfiles

---
 sbin/run_integration_test.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sbin/run_integration_test.sh b/sbin/run_integration_test.sh
index 54a9a55c6..c51fdf2cd 100755
--- a/sbin/run_integration_test.sh
+++ b/sbin/run_integration_test.sh
@@ -135,9 +135,12 @@ function cleanup {
       CREATE_TIME="${parts[3]}"
 
       echo "Saving logs for job ${TASK_NAME} allocation ${ALLOC_ID}"
-      docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stderr "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stderr.log"
-      docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stdout "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stdout.log"
+      docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stderr "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stderr.log" || true
+      docker exec server.station.nomad.nomad-cluster.jumppad.dev nomad alloc logs -stdout "${ALLOC_ID}" "${TASK_NAME}" > "log/allocations/${ALLOC_NAME}-${TASK_NAME}-${CREATE_TIME}-${ALLOC_ID}.stdout.log" || true
     done
+
+    # clean up empty files (most containers log to either stderr or stdout)
+    find log -size 0 | xargs rm
   fi
   if [ -z "${preserve}" ]; then
     make stop > /dev/null 2>&1
-- 
GitLab