From 3815dd5e64fc374fa4dcc5064470cd7a7d77aaf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikodem=20Rabuli=C5=84ski?= Date: Fri, 30 May 2025 09:07:41 +0200 Subject: [PATCH] tests/functional2/commands: fix failure with auto-allocate-uids The custom subcommand test fixture used to replace the environment with PATH prepended with the directory of the subcommand. This caused the tests to fail on darwin with auto-allocate-uids enabled, as the dynamic users aren't added to the user database inside the sandbox, as opposed to linux. Other environments were unaffected because the build user is a real user with a database entry and HOME set. Update the environment instead, also preserving hermetic env created earlier by NixCommand constructor. Change-Id: I7e59fd69ff13d1d395316d857b63a356e1648159 --- tests/functional2/commands/test_custom_sub_commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional2/commands/test_custom_sub_commands.py b/tests/functional2/commands/test_custom_sub_commands.py index 246e7c301..f07ffba16 100644 --- a/tests/functional2/commands/test_custom_sub_commands.py +++ b/tests/functional2/commands/test_custom_sub_commands.py @@ -96,7 +96,7 @@ def test_sub_commands( ): # Test custom sub commands in various configurations nix_command = nix.nix([custom_sub_command, "--version"], nix_exe=nix_exe) - nix_command.with_env(PATH=path) + nix_command.update_env(PATH=path) if flag: nix_command.settings.feature("lix-custom-sub-commands") @@ -114,7 +114,7 @@ def test_sub_command_path_order( # Test handling of the order of the path for custom sub commands # Incidentally also tests passing through exit codes nix_command = nix.nix([failing_sub_command, "--version"], nix_exe="lix") - nix_command.with_env(PATH=path_with_failure) + nix_command.update_env(PATH=path_with_failure) nix_command.settings.feature("lix-custom-sub-commands") nix_command.run().expect(expected)