|
156 | 156 |
|
157 | 157 | server.succeed(f"incus exec {instance_name} -- test -e /dev/tpm0") |
158 | 158 | server.succeed(f"incus exec {instance_name} -- test -e /dev/tpmrm0") |
| 159 | +
|
| 160 | + with subtest("[${image_id}] default configuration.nix is created on first boot"): |
| 161 | + server.succeed(f"incus exec {instance_name} -- test -f /etc/nixos/configuration.nix") |
| 162 | +
|
| 163 | + with subtest("[${image_id}] configuration.nix create service does not overwrite existing config"): |
| 164 | + server.succeed(f"incus exec {instance_name} -- systemctl restart incus-create-nixos-config.service") |
| 165 | + status = server.succeed( |
| 166 | + f"incus exec {instance_name} -- systemctl show -p ActiveState incus-create-nixos-config.service" |
| 167 | + ).strip() |
| 168 | + assert "inactive" in status, f"Expected inactive (ConditionPathExists should prevent start), got {status}" |
159 | 169 | '' |
160 | 170 | # |
161 | 171 | # container specific |
|
164 | 174 | lib.optionalString (config.type == "container") |
165 | 175 | # python |
166 | 176 | '' |
| 177 | + with subtest("[${image_id}] switch-to-configuration updates /sbin/init via installBootLoader"): |
| 178 | + # Remove /sbin/init so we can verify installBootLoader recreates it |
| 179 | + server.succeed(f"incus exec {instance_name} -- rm -f /sbin/init") |
| 180 | + server.fail(f"incus exec {instance_name} -- test -e /sbin/init") |
| 181 | +
|
| 182 | + server.succeed( |
| 183 | + f"incus exec {instance_name} -- /run/current-system/bin/switch-to-configuration switch" |
| 184 | + ) |
| 185 | +
|
| 186 | + # Verify installBootLoader recreated /sbin/init pointing to the system's init |
| 187 | + server.succeed(f"incus exec {instance_name} -- test -x /sbin/init") |
| 188 | + target = server.succeed(f"incus exec {instance_name} -- readlink -f /sbin/init").strip() |
| 189 | + current = server.succeed(f"incus exec {instance_name} -- readlink -f /run/current-system/init").strip() |
| 190 | + assert target == current, f"/sbin/init -> {target}, expected {current}" |
| 191 | +
|
167 | 192 | # TODO troubleshoot VM hot memory resizing which was introduced in 6.12 |
168 | 193 | with subtest("[${image_id}] memory limits can be hotplug changed"): |
169 | 194 | server.set_instance_config(instance_name, "limits.memory 512MB") |
|
0 commit comments