mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-30 14:11:21 +00:00
nixos/config/swap: check failure in swap file test
This commit is contained in:
parent
3fedce78b2
commit
9b47ad6682
@ -32,6 +32,8 @@ import ./make-test-python.nix ({ lib, ... }:
|
|||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
machine.wait_for_unit('var-swapfile.swap')
|
machine.wait_for_unit('var-swapfile.swap')
|
||||||
|
# Ensure the swap file creation script ran to completion without failing when creating the swap file
|
||||||
|
machine.fail("systemctl is-failed --quiet mkswap-var-swapfile.service")
|
||||||
machine.succeed("stat --file-system --format=%T /var/swapfile | grep btrfs")
|
machine.succeed("stat --file-system --format=%T /var/swapfile | grep btrfs")
|
||||||
# First run. Auto creation.
|
# First run. Auto creation.
|
||||||
machine.succeed("swapon --show | grep /var/swapfile")
|
machine.succeed("swapon --show | grep /var/swapfile")
|
||||||
@ -41,6 +43,8 @@ import ./make-test-python.nix ({ lib, ... }:
|
|||||||
|
|
||||||
# Second run. Use it as-is.
|
# Second run. Use it as-is.
|
||||||
machine.wait_for_unit('var-swapfile.swap')
|
machine.wait_for_unit('var-swapfile.swap')
|
||||||
|
# Ensure the swap file creation script ran to completion without failing when the swap file already exists
|
||||||
|
machine.fail("systemctl is-failed --quiet mkswap-var-swapfile.service")
|
||||||
machine.succeed("swapon --show | grep /var/swapfile")
|
machine.succeed("swapon --show | grep /var/swapfile")
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user