From 9bb2a979d4cc690e424c1cc292f99ac895b5dd18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6gler?= Date: Sat, 22 Oct 2022 13:07:09 +0200 Subject: [PATCH] nixos/tests/machinectl: Disable tmpfs for /tmp --- nixos/tests/systemd-machinectl.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nixos/tests/systemd-machinectl.nix b/nixos/tests/systemd-machinectl.nix index fa5c81599eb0..b8ed0c33e8e4 100644 --- a/nixos/tests/systemd-machinectl.nix +++ b/nixos/tests/systemd-machinectl.nix @@ -44,6 +44,14 @@ import ./make-test-python.nix ({ pkgs, ... }: # not needed, but we want to test the nspawn file generation systemd.nspawn.${containerName} = { }; + + systemd.services."systemd-nspawn@${containerName}" = { + serviceConfig.Environment = [ + # Disable tmpfs for /tmp + "SYSTEMD_NSPAWN_TMPFS_TMP=0" + ]; + overrideStrategy = "asDropin"; + }; }; testScript = '' @@ -95,6 +103,9 @@ import ./make-test-python.nix ({ pkgs, ... }: machine.succeed("machinectl stop ${containerName}"); machine.wait_until_succeeds("test $(systemctl is-active systemd-nspawn@${containerName}) = inactive"); + # Test tmpfs for /tmp + machine.fail("mountpoint /tmp"); + # Show to to delete the container machine.succeed("chattr -i ${containerRoot}/var/empty"); machine.succeed("rm -rf ${containerRoot}");