mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
nixos/tests: Load root profile in nspawn tests
This is currently a hacky workarround, but bettern than nothing until we come up with a better solution.
This commit is contained in:
parent
d9beb24fdd
commit
0dc4ca4c71
2 changed files with 9 additions and 4 deletions
|
|
@ -1587,7 +1587,7 @@ class NspawnMachine(BaseMachine):
|
|||
# NOTE If the test calls switch-to-configuration (with a differently configured specialization)
|
||||
# this will use the /etc/profile of the new specialisation while `QemuMachine` nodes
|
||||
# will continue to use the original /etc/profile.
|
||||
command = f"set -eo pipefail; source /etc/profile; set -u; {command}"
|
||||
command = f"set -eo pipefail; USER=root HOME=/root source /etc/profile; set -u; {command}"
|
||||
|
||||
cp = subprocess.run(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
{
|
||||
name = "simple-container";
|
||||
|
||||
containers.machine = { };
|
||||
containers = {
|
||||
machine = { pkgs, ... }: {
|
||||
users.users.root.packages = [ pkgs.hello ];
|
||||
};
|
||||
noprofile = { };
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.shutdown()
|
||||
machine.succeed("hello")
|
||||
noprofile.fail("hello")
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue