Unverified Commit 45225c04 authored by Adam C. Stephens's avatar Adam C. Stephens
Browse files

nixosTests.incus: add test of container channel setup

parent 0726a0ec
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -45,6 +45,15 @@ in
    };
  };

  channel = incusRunTest {
    name = "channel";

    instances.c1 = {
      type = "container";
      copyChannel = true;
    };
  };

  # used in lxc tests to verify container functionality
  container = incusRunTest {
    name = "container";
+67 −59
Original line number Diff line number Diff line
@@ -60,6 +60,11 @@ in
                default = { };
              };

              copyChannel = lib.mkEnableOption ''
                copy channel in test image. disabled by default as it forces image
                rebuilds excessively. enable to validate channel things.
              '';

              testScript = lib.mkOption {
                type = lib.types.str;
                description = "final script provided to test runner";
@@ -104,7 +109,7 @@ in
                  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;
                  system.installer.channel.enable = lib.mkForce config.copyChannel;

                  environment.etc."nix/registry.json".text = lib.mkForce "{}";

@@ -170,8 +175,7 @@ in
                #
                # container specific
                #
                +
                  lib.optionalString (config.type == "container")
                + lib.optionalString (config.type == "container") (
                  # python
                  ''
                    with subtest("[${image_id}] switch-to-configuration updates /sbin/init via installBootLoader"):
@@ -227,7 +231,11 @@ in
                            server.wait_for_instance(instance_name)
                            server.succeed(f"pgrep -a lxcfs | grep 'incus/devices/{instance_name}/lxcfs'")
                  ''

                  + lib.optionalString (config.copyChannel) ''
                    with subtest("[${image_id}] channel copied correctly"):
                        server.succeed(f"incus exec {instance_name} -- systemctl status nix-channel-init.service")
                  ''
                )
                #
                # virtual-machine specific
                #