From 0cd74d9aaf0be2f7e2f19a022492f36239700189 Mon Sep 17 00:00:00 2001 From: olalekan odukoya Date: Mon, 27 Jan 2025 17:36:44 +0100 Subject: [PATCH] use temp directory as destination directory for copy command Signed-off-by: olalekan odukoya --- hack/test-templates.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hack/test-templates.sh b/hack/test-templates.sh index 8dfe2e24835..78e6d2d7388 100755 --- a/hack/test-templates.sh +++ b/hack/test-templates.sh @@ -192,10 +192,11 @@ if [ "$got" != "$expected" ]; then fi INFO "Testing limactl copy command" -tmpfile="$HOME/lima-hostname" +tmpdir="$(mktemp -d ${TMPDIR:-/tmp}/lima-test-templates.XXXXXX)" +defer "rm -rf \"$tmpdir\"" +tmpfile="$tmpdir/lima-hostname" rm -f "$tmpfile" limactl cp "$NAME":/etc/hostname "$tmpfile" -defer "rm -f \"$tmpfile\"" expected="$(limactl shell "$NAME" cat /etc/hostname)" got="$(cat "$tmpfile")" INFO "/etc/hostname: expected=${expected}, got=${got}"