1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-19 16:09:19 +03:00
nixpkgs/nixos/tests/lxd/preseed.nix

72 lines
1.8 KiB
Nix
Raw Permalink Normal View History

import ../make-test-python.nix (
{ pkgs, lib, ... }:
2023-09-04 11:58:53 -04:00
{
name = "lxd-preseed";
2023-09-04 11:58:53 -04:00
nodes.machine =
{ lib, ... }:
{
virtualisation = {
diskSize = 4096;
2023-09-04 11:58:53 -04:00
lxc.lxcfs.enable = true;
lxd.enable = true;
2023-09-04 11:58:53 -04:00
lxd.preseed = {
networks = [
{
name = "nixostestbr0";
type = "bridge";
config = {
"ipv4.address" = "10.0.100.1/24";
"ipv4.nat" = "true";
};
}
];
profiles = [
{
name = "nixostest_default";
devices = {
eth0 = {
name = "eth0";
network = "nixostestbr0";
type = "nic";
};
root = {
path = "/";
pool = "default";
size = "35GiB";
type = "disk";
};
};
}
];
storage_pools = [
{
name = "nixostest_pool";
driver = "dir";
}
];
};
};
2023-09-04 11:58:53 -04:00
};
testScript = ''
def wait_for_preseed(_) -> bool:
_, output = machine.systemctl("is-active lxd-preseed.service")
return ("inactive" in output)
2023-09-04 11:58:53 -04:00
machine.wait_for_unit("sockets.target")
machine.wait_for_unit("lxd.service")
with machine.nested("Waiting for preseed to complete"):
retry(wait_for_preseed)
2023-09-04 11:58:53 -04:00
with subtest("Verify preseed resources created"):
machine.succeed("lxc profile show nixostest_default")
machine.succeed("lxc network info nixostestbr0")
machine.succeed("lxc storage show nixostest_pool")
'';
}
)