nixos/tests/systemd-repart: make sizeDiff configurable

The +32M is not sufficient to create additional partitions.
Make it configurable.
This commit is contained in:
Florian Klink
2025-07-04 22:50:49 +03:00
parent e47cbf3942
commit 28d41fc591

View File

@@ -9,9 +9,16 @@ with pkgs.lib;
let
# A testScript fragment that prepares a disk with some empty, unpartitioned
# space. and uses it to boot the test with. Takes a single argument `machine`
# from which the diskImage is extracted.
useDiskImage = machine: ''
# space. and uses it to boot the test with.
# Takes two arguments, `machine` from which the diskImage is extracted,
# as well an optional `sizeDiff` (defaulting to +32M), describing how should
# be resized.
useDiskImage =
{
machine,
sizeDiff ? "+32M",
}:
''
import os
import shutil
import subprocess
@@ -27,7 +34,7 @@ let
"-f",
"raw",
tmp_disk_image.name,
"+32M",
"${sizeDiff}",
])
# Set NIX_DISK_IMAGE so that the qemu script finds the right disk image.
@@ -98,7 +105,7 @@ in
testScript =
{ nodes, ... }:
''
${useDiskImage nodes.machine}
${useDiskImage { inherit (nodes) machine; }}
machine.start()
machine.wait_for_unit("multi-user.target")
@@ -128,7 +135,7 @@ in
testScript =
{ nodes, ... }:
''
${useDiskImage nodes.machine}
${useDiskImage { inherit (nodes) machine; }}
machine.start()
machine.wait_for_unit("multi-user.target")
@@ -196,7 +203,7 @@ in
testScript =
{ nodes, ... }:
''
${useDiskImage nodes.machine}
${useDiskImage { inherit (nodes) machine; }}
machine.start()
machine.wait_for_unit("multi-user.target")