mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
etc: extend tests to ensure that temporary dirs are cleaned up
This commit is contained in:
parent
0f786baf5d
commit
65f375d172
@ -27,9 +27,14 @@
|
||||
specialisation.new-generation.configuration = {
|
||||
environment.etc."newgen".text = "newgen";
|
||||
};
|
||||
specialisation.newer-generation.configuration = {
|
||||
environment.etc."newergen".text = "newergen";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
testScript = /* python */ ''
|
||||
newergen = machine.succeed("realpath /run/current-system/specialisation/newer-generation/bin/switch-to-configuration").rstrip()
|
||||
|
||||
with subtest("/run/etc-metadata/ is mounted"):
|
||||
print(machine.succeed("mountpoint /run/etc-metadata"))
|
||||
|
||||
@ -79,5 +84,13 @@
|
||||
print(machine.succeed("ls /etc/mountpoint"))
|
||||
print(machine.succeed("stat /etc/mountpoint/extra-file"))
|
||||
print(machine.succeed("findmnt /etc/filemount"))
|
||||
|
||||
machine.succeed(f"{newergen} switch")
|
||||
|
||||
tmpMounts = machine.succeed("find /tmp -maxdepth 1 -type d -regex '/tmp/nixos-etc\\..*' | wc -l").rstrip()
|
||||
metaMounts = machine.succeed("find /tmp -maxdepth 1 -type d -regex '/tmp/nixos-etc-metadata\\..*' | wc -l").rstrip()
|
||||
|
||||
assert tmpMounts == "0", f"Found {tmpMounts} remaining tmpmounts"
|
||||
assert metaMounts == "1", f"Found {metaMounts} remaining metamounts"
|
||||
'';
|
||||
}
|
||||
|
@ -15,9 +15,14 @@
|
||||
specialisation.new-generation.configuration = {
|
||||
environment.etc."newgen".text = "newgen";
|
||||
};
|
||||
specialisation.newer-generation.configuration = {
|
||||
environment.etc."newergen".text = "newergen";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
testScript = /* python */ ''
|
||||
newergen = machine.succeed("realpath /run/current-system/specialisation/newer-generation/bin/switch-to-configuration").rstrip()
|
||||
|
||||
with subtest("/run/etc-metadata/ is mounted"):
|
||||
print(machine.succeed("mountpoint /run/etc-metadata"))
|
||||
|
||||
@ -55,5 +60,14 @@
|
||||
print(machine.succeed("findmnt /etc/mountpoint"))
|
||||
print(machine.succeed("stat /etc/mountpoint/extra-file"))
|
||||
print(machine.succeed("findmnt /etc/filemount"))
|
||||
|
||||
machine.succeed(f"{newergen} switch")
|
||||
assert machine.succeed("cat /etc/newergen") == "newergen"
|
||||
|
||||
tmpMounts = machine.succeed("find /tmp -maxdepth 1 -type d -regex '/tmp/nixos-etc\\..*' | wc -l").rstrip()
|
||||
metaMounts = machine.succeed("find /tmp -maxdepth 1 -type d -regex '/tmp/nixos-etc-metadata\\..*' | wc -l").rstrip()
|
||||
|
||||
assert tmpMounts == "0", f"Found {tmpMounts} remaining tmpmounts"
|
||||
assert metaMounts == "1", f"Found {metaMounts} remaining metamounts"
|
||||
'';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user