summaryrefslogtreecommitdiffstats
path: root/test/units/testsuite-13.sh
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-04-18 18:39:18 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-18 23:17:16 +0200
commit2362fdde1bd4bf54772383ef29431f683729ba76 (patch)
treef6553d8adac1a2c49c86d4faf378860c2ce9d5d2 /test/units/testsuite-13.sh
parenthwdb: Update 60-keyboard.hwdb (#23074) (diff)
downloadsystemd-2362fdde1bd4bf54772383ef29431f683729ba76.tar.xz
systemd-2362fdde1bd4bf54772383ef29431f683729ba76.zip
nspawn: fix locating config files with --ephemeral
When --ephemeral is used, a random 16 characters suffix is added to the image name, so matching on .nspawn files based on the image name no longer works. Fixes https://github.com/systemd/systemd/issues/13297
Diffstat (limited to '')
-rwxr-xr-xtest/units/testsuite-13.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/units/testsuite-13.sh b/test/units/testsuite-13.sh
index 554d098ef5..38b6feae78 100755
--- a/test/units/testsuite-13.sh
+++ b/test/units/testsuite-13.sh
@@ -120,6 +120,23 @@ function check_selinux {
systemd-nspawn "${SUSE_OPTS[@]}" --register=no -b -D /testsuite-13.nc-container --selinux-apifs-context=system_u:object_r:container_file_t:s0:c0,c1 --selinux-context=system_u:system_r:container_t:s0:c0,c1
}
+function check_ephemeral_config {
+ # https://github.com/systemd/systemd/issues/13297
+ local _cmd='test -f /tmp/ephemeral-config'
+
+ mkdir -p /run/systemd/nspawn/
+ cat >/run/systemd/nspawn/testsuite-13.nc-container.nspawn <<EOF
+[Files]
+BindReadOnly=/tmp/ephemeral-config
+EOF
+ touch /tmp/ephemeral-config
+
+ # /testsuite-13.nc-container is prepared by test.sh
+ systemd-nspawn --register=no -D /testsuite-13.nc-container --ephemeral /bin/sh -x -c "$_cmd"
+
+ rm -f /run/systemd/nspawn/testsuite-13.nc-container.nspawn
+}
+
function run {
if [[ "$1" = "yes" && "$is_v2_supported" = "no" ]]; then
printf "Unified cgroup hierarchy is not supported. Skipping.\n" >&2
@@ -206,4 +223,6 @@ check_machinectl_bind
check_selinux
+check_ephemeral_config
+
touch /testok