mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/tests/libvirtd: init
This commit is contained in:
parent
3e373de301
commit
38c67944cb
3 changed files with 53 additions and 0 deletions
|
@ -284,6 +284,7 @@ in {
|
||||||
libreswan = handleTest ./libreswan.nix {};
|
libreswan = handleTest ./libreswan.nix {};
|
||||||
librewolf = handleTest ./firefox.nix { firefoxPackage = pkgs.librewolf; };
|
librewolf = handleTest ./firefox.nix { firefoxPackage = pkgs.librewolf; };
|
||||||
libuiohook = handleTest ./libuiohook.nix {};
|
libuiohook = handleTest ./libuiohook.nix {};
|
||||||
|
libvirtd = handleTest ./libvirtd.nix {};
|
||||||
lidarr = handleTest ./lidarr.nix {};
|
lidarr = handleTest ./lidarr.nix {};
|
||||||
lightdm = handleTest ./lightdm.nix {};
|
lightdm = handleTest ./lightdm.nix {};
|
||||||
lighttpd = handleTest ./lighttpd.nix {};
|
lighttpd = handleTest ./lighttpd.nix {};
|
||||||
|
|
49
nixos/tests/libvirtd.nix
Normal file
49
nixos/tests/libvirtd.nix
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||||
|
name = "libvirtd";
|
||||||
|
meta.maintainers = with pkgs.lib.maintainers; [ fpletz ];
|
||||||
|
|
||||||
|
nodes = {
|
||||||
|
virthost =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
virtualisation = {
|
||||||
|
cores = 2;
|
||||||
|
memorySize = 2048;
|
||||||
|
|
||||||
|
libvirtd.enable = true;
|
||||||
|
};
|
||||||
|
networking.nameservers = [ "192.168.122.1" ];
|
||||||
|
security.polkit.enable = true;
|
||||||
|
environment.systemPackages = with pkgs; [ virt-manager ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript = let
|
||||||
|
nixosInstallISO = (import ../release.nix {}).iso_minimal.${pkgs.hostPlatform.system};
|
||||||
|
virshShutdownCmd = if pkgs.stdenv.isx86_64 then "shutdown" else "destroy";
|
||||||
|
in ''
|
||||||
|
start_all()
|
||||||
|
|
||||||
|
virthost.wait_for_unit("sockets.target")
|
||||||
|
|
||||||
|
with subtest("enable default network"):
|
||||||
|
virthost.succeed("virsh net-start default")
|
||||||
|
virthost.succeed("virsh net-autostart default")
|
||||||
|
virthost.succeed("virsh net-info default")
|
||||||
|
|
||||||
|
with subtest("check if partition disk pools works with parted"):
|
||||||
|
virthost.succeed("fallocate -l100m /tmp/foo; losetup /dev/loop0 /tmp/foo; echo 'label: dos' | sfdisk /dev/loop0")
|
||||||
|
virthost.succeed("virsh pool-create-as foo disk --source-dev /dev/loop0 --target /dev")
|
||||||
|
virthost.succeed("virsh vol-create-as foo loop0p1 25MB")
|
||||||
|
virthost.succeed("virsh vol-create-as foo loop0p2 50MB")
|
||||||
|
|
||||||
|
with subtest("check if nixos install iso boots and network works"):
|
||||||
|
virthost.succeed(
|
||||||
|
"virt-install -n nixos --osinfo=nixos-unstable --ram=1024 --graphics=none --disk=`find ${nixosInstallISO}/iso -type f | head -n1`,readonly=on --import --noautoconsole"
|
||||||
|
)
|
||||||
|
virthost.succeed("virsh domstate nixos | grep running")
|
||||||
|
virthost.wait_until_succeeds("ping -c 1 nixos")
|
||||||
|
virthost.succeed("virsh ${virshShutdownCmd} nixos")
|
||||||
|
virthost.wait_until_succeeds("virsh domstate nixos | grep 'shut off'")
|
||||||
|
'';
|
||||||
|
})
|
|
@ -36,6 +36,7 @@
|
||||||
, xhtml1
|
, xhtml1
|
||||||
, yajl
|
, yajl
|
||||||
, writeScript
|
, writeScript
|
||||||
|
, nixosTests
|
||||||
|
|
||||||
# Linux
|
# Linux
|
||||||
, acl ? null
|
, acl ? null
|
||||||
|
@ -349,6 +350,8 @@ stdenv.mkDerivation rec {
|
||||||
update-source-version perlPackages.SysVirt "$sysvirtVersion" --file="pkgs/top-level/perl-packages.nix"
|
update-source-version perlPackages.SysVirt "$sysvirtVersion" --file="pkgs/top-level/perl-packages.nix"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.tests.libvirtd = nixosTests.libvirtd;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "https://libvirt.org/";
|
homepage = "https://libvirt.org/";
|
||||||
description = ''
|
description = ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue