From 5908999e6d77577b050bc596ab64d16a5eabafed Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 9 Aug 2023 17:42:36 -0600 Subject: [PATCH] New partial-line test is flaking ...possibly because we somehow ended up with a two-line log file for a simple 'echo hi'? Make our timestamp-getting code safer by adding 'head -1'. Signed-off-by: Ed Santiago --- test/system/035-logs.bats | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats index a606b772e2..9868d4e3cf 100644 --- a/test/system/035-logs.bats +++ b/test/system/035-logs.bats @@ -398,16 +398,21 @@ $content--2.*" "logs --until -f on running container works" # Hand-craft a log file with partial lines and carriage returns run_podman inspect --format '{{.HostConfig.LogConfig.Path}}' $cname logpath="$output" - timestamp=$(awk '{print $1}' <"$logpath") + timestamp=$(head -n1 "$logpath" | awk '{print $1}') cr=$'\r' nl=$'\n' - cat >| $logpath < $logpath <