From 46b6ea9ccd1c68c4a561078ebe48f6e042d8623d Mon Sep 17 00:00:00 2001 From: nicoo Date: Sun, 16 Jun 2024 17:42:45 +0000 Subject: [PATCH] tests/systemd-user-config: Handle default settings The test now gracefully handles changes in the systemd module --- tests/modules/systemd/user-config.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/modules/systemd/user-config.nix b/tests/modules/systemd/user-config.nix index f977d2f1..81f51f0c 100644 --- a/tests/modules/systemd/user-config.nix +++ b/tests/modules/systemd/user-config.nix @@ -13,13 +13,9 @@ nmt.script = '' userConf=home-files/.config/systemd/user.conf assertFileExists $userConf - assertFileContent $userConf ${ - pkgs.writeText "expected" '' - [Manager] - DefaultCPUAccounting=true - DefaultEnvironment=PATH='/bin:/sbin:/some where' TEST='abc' - LogLevel=debug - '' - } + [ "$(head -n1 "$TESTED/$userConf")" == "[Manager]" ] || exit 1 + assertFileContains $userConf DefaultCPUAccounting=true + assertFileContains $userConf LogLevel=debug + assertFileRegex $userConf "^DefaultEnvironment=.*PATH='/bin:/sbin:/some where' .*TEST='abc'" ''; }