From 8d9e3502aba39127e4d12196dae16d306f76993d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 21 Mar 2025 18:20:56 +0100 Subject: [PATCH] hack: Fix TestOverlay* test failure in pkg/archive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pkg/archive/archive_linux_test.go tests create a test archive content in a temporary directory. This also includes device nodes (using mknod). Running these tests in Docker-in-Docker (dind) with systemd was failing with "operation not permitted" because the rootfs is remounted with `nodev`. This change aligns `hack/dind-systemd` with `hack/dind` by conditionally mounting a `tmpfs` on `/tmp` (with dev enabled), to make the mknod work. Signed-off-by: Paweł Gronowski --- hack/dind | 2 ++ hack/dind-systemd | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/hack/dind b/hack/dind index dbe6949792..f82d3aca65 100755 --- a/hack/dind +++ b/hack/dind @@ -52,6 +52,8 @@ if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then fi # Mount /tmp (conditionally) +# /tmp must be 'exec,rw', and 'dev' to allow mknod to work for the +# pkg/archive/archive_linux_test.go tests. if ! mountpoint -q /tmp; then mount -t tmpfs none /tmp fi diff --git a/hack/dind-systemd b/hack/dind-systemd index 892708ff2f..ad90560ac6 100755 --- a/hack/dind-systemd +++ b/hack/dind-systemd @@ -19,6 +19,13 @@ if [ ! -t 0 ]; then exit 1 fi +# Mount /tmp (conditionally) +# /tmp must be 'exec,rw', and 'dev' (defaults) to allow mknod to work for the +# pkg/archive/archive_linux_test.go tests. +if ! mountpoint -q /tmp; then + mount -t tmpfs none /tmp +fi + # Change mount propagation to shared, which SystemD PID 1 would normally do # itself when started by the kernel. SystemD skips that when it detects it is # running in a container.