Unverified Commit ba01a5e8 authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

nixosTests.lxc: fix lxc test and move to runTestOn (#460219)

parents 4a756f79 f77edd59
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -26,8 +26,9 @@
  services.openssh.enable = lib.mkDefault true;
  services.openssh.startWhenNeeded = lib.mkDefault true;

  # As this is intended as a standalone image, undo some of the minimal profile stuff
  documentation.enable = lib.mkDefault true;
  documentation.nixos.enable = lib.mkDefault true;
  # friendlier defaults than minimal profile provides
  # but we can't use mkDefault since minimal uses it
  documentation.enable = lib.mkOverride 890 true;
  documentation.nixos.enable = lib.mkOverride 890 true;
  services.logrotate.enable = true;
}
+1 −1
Original line number Diff line number Diff line
@@ -889,7 +889,7 @@ in
  lorri = handleTest ./lorri/default.nix { };
  luks = runTest ./luks.nix;
  lvm2 = handleTest ./lvm2 { };
  lxc = handleTest ./lxc { };
  lxc = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./lxc;
  lxd-image-server = runTest ./lxd-image-server.nix;
  lxqt = runTest ./lxqt.nix;
  ly = runTest ./ly.nix;
+113 −109
Original line number Diff line number Diff line
import ../make-test-python.nix (
{ pkgs, lib, ... }:

let
@@ -6,11 +5,19 @@ import ../make-test-python.nix (
    configuration = {
      # Building documentation makes the test unnecessarily take a longer time:
      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-rootfs = releases.incusContainerImage.${pkgs.stdenv.hostPlatform.system};
  lxc-image-metadata =
    releases.incusContainerMeta.${pkgs.stdenv.hostPlatform.system}
    + "/tarball/nixos-image-lxc-*-${pkgs.stdenv.hostPlatform.system}.tar.xz";
  # the incus container rootfs is in squashfs, but lxc requires tar.xz so use containerTarball
  lxc-image-rootfs =
    releases.containerTarball.${pkgs.stdenv.hostPlatform.system}
    + "/tarball/nixos-image-lxc-*-${pkgs.stdenv.hostPlatform.system}.tar.xz";

in
{
@@ -20,9 +27,7 @@ import ../make-test-python.nix (
    maintainers = lib.teams.lxc.members;
  };

    nodes.machine =
      { lib, pkgs, ... }:
      {
  nodes.machine = {
    virtualisation = {
      diskSize = 6144;
      cores = 2;
@@ -109,7 +114,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/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-stop test'")

@@ -121,4 +126,3 @@ import ../make-test-python.nix (
    machine.fail("su -- bob -c 'lxc-start test'")
  '';
}
)