From 7c73d050919e9f497bdccaff2b0529edf4aa0147 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..709b2e82ea0 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 /var/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}"