2019-11-05 00:38:50 +01:00
|
|
|
import ./make-test-python.nix {
|
2018-08-22 03:39:27 +02:00
|
|
|
name = "fsck";
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { lib, ... }: {
|
2018-08-22 03:39:27 +02:00
|
|
|
virtualisation.emptyDiskImages = [ 1 ];
|
|
|
|
|
2021-02-14 12:23:50 +01:00
|
|
|
virtualisation.fileSystems = {
|
2018-08-22 03:39:27 +02:00
|
|
|
"/mnt" = {
|
|
|
|
device = "/dev/vdb";
|
|
|
|
fsType = "ext4";
|
|
|
|
autoFormat = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-11-05 00:38:50 +01:00
|
|
|
machine.wait_for_unit("default.target")
|
2018-08-22 03:39:27 +02:00
|
|
|
|
2019-11-05 00:38:50 +01:00
|
|
|
with subtest("root fs is fsckd"):
|
|
|
|
machine.succeed("journalctl -b | grep 'fsck.ext4.*/dev/vda'")
|
2018-08-22 03:39:27 +02:00
|
|
|
|
2019-11-05 00:38:50 +01:00
|
|
|
with subtest("mnt fs is fsckd"):
|
|
|
|
machine.succeed("journalctl -b | grep 'fsck.*/dev/vdb.*clean'")
|
|
|
|
machine.succeed(
|
|
|
|
"grep 'Requires=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount"
|
|
|
|
)
|
|
|
|
machine.succeed(
|
|
|
|
"grep 'After=systemd-fsck@dev-vdb.service' /run/systemd/generator/mnt.mount"
|
|
|
|
)
|
2018-08-22 03:39:27 +02:00
|
|
|
'';
|
|
|
|
}
|