nixosTests.lxc: fix lxc test

This commit is contained in:
Adam C. Stephens
2025-11-09 20:19:00 -05:00
parent eb909917b9
commit 0cd29d61c5
2 changed files with 14 additions and 6 deletions

View File

@@ -26,8 +26,9 @@
services.openssh.enable = lib.mkDefault true; services.openssh.enable = lib.mkDefault true;
services.openssh.startWhenNeeded = lib.mkDefault true; services.openssh.startWhenNeeded = lib.mkDefault true;
# As this is intended as a standalone image, undo some of the minimal profile stuff # friendlier defaults than minimal profile provides
documentation.enable = lib.mkDefault true; # but we can't use mkDefault since minimal uses it
documentation.nixos.enable = lib.mkDefault true; documentation.enable = lib.mkOverride 890 true;
documentation.nixos.enable = lib.mkOverride 890 true;
services.logrotate.enable = true; services.logrotate.enable = true;
} }

View File

@@ -6,11 +6,18 @@ import ../make-test-python.nix (
configuration = { configuration = {
# Building documentation makes the test unnecessarily take a longer time: # Building documentation makes the test unnecessarily take a longer time:
documentation.enable = lib.mkForce false; documentation.enable = lib.mkForce false;
documentation.nixos.enable = lib.mkForce false;
# including a channel forces images to be rebuilt on any changes
system.installer.channel.enable = lib.mkForce false;
}; };
}; };
lxc-image-metadata = releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system}; lxc-image-metadata =
lxc-image-rootfs = releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system}; releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system}
+ "/tarball/nixos-image-lxc-*-${pkgs.stdenv.hostPlatform.system}.tar.xz";
lxc-image-rootfs =
releases.containerTarball.${pkgs.stdenv.hostPlatform.system}
+ "/tarball/nixos-image-lxc-*-${pkgs.stdenv.hostPlatform.system}.tar.xz";
in in
{ {
@@ -109,7 +116,7 @@ import ../make-test-python.nix (
machine.execute("su -- alice -c 'cp /etc/lxc/default.conf ~/.config/lxc/'") machine.execute("su -- alice -c 'cp /etc/lxc/default.conf ~/.config/lxc/'")
machine.execute("su -- alice -c 'cp /etc/lxc/lxc.conf ~/.config/lxc/'") machine.execute("su -- alice -c 'cp /etc/lxc/lxc.conf ~/.config/lxc/'")
machine.succeed("su -- alice -c 'lxc-create -t local -n test -- --metadata ${lxc-image-metadata}/*/*.tar.xz --fstree ${lxc-image-rootfs}/*/*.tar.xz'") machine.succeed("su -- alice -c 'lxc-create -t local -n test -- --metadata ${lxc-image-metadata} --fstree ${lxc-image-rootfs}'")
machine.succeed("su -- alice -c 'lxc-start test'") machine.succeed("su -- alice -c 'lxc-start test'")
machine.succeed("su -- alice -c 'lxc-stop test'") machine.succeed("su -- alice -c 'lxc-stop test'")