1 # Tests the contents attribute of nixos/lib/make-disk-image.nix
2 # including its user, group, and mode attributes.
3 { system ? builtins.currentSystem,
5 pkgs ? import ../.. { inherit system config; }
8 with import ../lib/testing-python.nix { inherit system pkgs; };
11 with import common/ec2.nix { inherit makeTest pkgs; };
14 config = (import ../lib/eval-config.nix {
17 ../modules/testing/test-instrumentation.nix
18 ../modules/profiles/qemu-guest.nix
20 fileSystems."/".device = "/dev/disk/by-label/nixos";
21 boot.loader.grub.device = "/dev/vda";
22 boot.loader.timeout = 0;
26 image = (import ../lib/make-disk-image.nix {
32 source = pkgs.writeText "testFile" "contents";
46 name = "image-contents";
51 # Test that if contents includes a file, it is copied to the target.
52 assert "content" in machine.succeed("cat /testFile")
53 fileDetails = machine.succeed("ls -l /testFile")
54 assert "1234" in fileDetails
55 assert "5678" in fileDetails
56 assert "rwxr-xr-x" in fileDetails
58 # Test that if contents includes a directory, it is copied to the target.
59 dirList = machine.succeed("ls /testDir")
60 assert "image-contents.nix" in dirList