]> git.scottworley.com Git - nixos-qemu-vm-isolation/blob - checks/mount-grep.nix
33478ea687c2229ababb3b7faa4568e479a47b71
[nixos-qemu-vm-isolation] / checks / mount-grep.nix
1 pkgs: {
2 name = "qemu-private-store-mount-grep";
3
4 hostPkgs = pkgs;
5
6 includeTestScriptReferences = false;
7
8 nodes = {
9 shared = _: { };
10 private = _: { imports = [ ../modules/qemu-vm-isolation.nix ]; };
11 useNixStoreImage = {
12 virtualisation = {
13 sharedDirectories = pkgs.lib.mkForce { };
14 useNixStoreImage = true;
15 };
16 };
17 };
18
19 testScript = ''
20 start_all()
21 shared.wait_for_unit("multi-user.target")
22 private.wait_for_unit("multi-user.target")
23 useNixStoreImage.wait_for_unit("multi-user.target")
24
25 shared.succeed("[[ $(mount | grep -c virt) -gt 0 ]]")
26 private.succeed("[[ $(mount | grep -c virt) -eq 0 ]]")
27 useNixStoreImage.succeed("[[ $(mount | grep -c virt) -eq 0 ]]")
28
29 shared.succeed("[[ -e ${pkgs.pv} ]]")
30 private.fail("[[ -e ${pkgs.pv} ]]")
31 useNixStoreImage.fail("[[ -e ${pkgs.pv} ]]")
32 '';
33 }