From 1d14bb7a8a7621bbb3bda3bc3825be6ab84e6d88 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Mon, 17 Jul 2023 10:50:44 -0600 Subject: [PATCH] quadlet systest: fix broken tmpdir references quadlet volume-path system test was making invalid assumptions about $TMPDIR, causing test to fail when TMPDIR=/var/tmp or /dev/shm Much more complicated than it should be, because we need to find out the systemd value of %T. Minor cleanup too. Signed-off-by: Ed Santiago --- test/system/252-quadlet.bats | 38 ++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/test/system/252-quadlet.bats b/test/system/252-quadlet.bats index d4badd194a..b13fd8f8b1 100644 --- a/test/system/252-quadlet.bats +++ b/test/system/252-quadlet.bats @@ -751,9 +751,35 @@ EOF remove_secret $SECRET_NAME } -@test "quadlet - volume path using specifier" { - local tmp_path=$(mktemp -d --tmpdir=$PODMAN_TMPDIR quadlet.volume.XXXXXX) - local tmp_dir=${tmp_path#/tmp/} +@test "quadlet - volume path using systemd %T specifier" { + # "specifier" is systemd-speak for "replaceable fields"; see systemd.unit(5) + # + # Step 1: determine what systemd is using for %T. There does not + # seem to be any systemctly way to find this. + local service=get-percent-t.$(random_string 10).service + local unitfile=${UNIT_DIR}/$service + cat >$unitfile < $tmp_path/$file_name @@ -762,7 +788,7 @@ EOF cat > $quadlet_file <