Skip to content

Commit 161fbeb

Browse files
authored
Enable Azure Linux 4.0 VM Tests (#719)
This PR adds the following tests for Azure Linux 4.0: - test_min_change_efi_azl4_qcow_output - test_min_change_legacy_azl4_qcow_output - test_min_change_efi_azl4_iso_bootstrap_output (skipped until ISO output is supported) - test_min_change_efi_azl4_iso_full_os_output (skipped until ISO output is supported) - test_min_change_legacy_azl4_iso_output (skipped until ISO output is supported) Follow-up tasks: - When another kernel release is available for Azure Linux 4.0 Alpha 2: change kernel-6.18.5-1.8.azl4~20260420 to a different release in os-vm-config-*-azl4.yaml, iso-full-os-vm-azl4.yaml, iso-bootstrap-vm-azl4.yaml
1 parent b71a612 commit 161fbeb

12 files changed

Lines changed: 275 additions & 9 deletions

.github/workflows/tests-vmtests.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,12 @@ jobs:
101101
102102
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-efi-vhdx-2.0-$HOST_ARCH" azl-core-efi-2.0
103103
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-efi-vhdx-3.0-$HOST_ARCH" azl-core-efi-3.0
104+
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-efi-vhdx-4.0-$HOST_ARCH" azl-core-efi-4.0
104105
105106
if [ "$HOST_ARCH" == "amd64" ]; then
106107
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-legacy-vhd-2.0-$HOST_ARCH" azl-core-legacy-2.0
107108
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-legacy-vhd-3.0-$HOST_ARCH" azl-core-legacy-3.0
109+
./repo/.github/workflows/scripts/download-image.sh "$AZURE_STORAGE" "$AZURE_CONTAINER" "azure-linux/core-legacy-vhd-4.0-$HOST_ARCH" azl-core-legacy-4.0
108110
fi
109111
env:
110112
HOST_ARCH: ${{ inputs.hostArch }}
@@ -159,9 +161,11 @@ jobs:
159161
160162
CORE_LEGACY_AZL2=""
161163
CORE_LEGACY_AZL3=""
164+
CORE_LEGACY_AZL4=""
162165
if [ "$HOST_ARCH" == "amd64" ]; then
163166
CORE_LEGACY_AZL2="../../../azl-core-legacy-2.0/image.vhd"
164167
CORE_LEGACY_AZL3="../../../azl-core-legacy-3.0/image.vhd"
168+
CORE_LEGACY_AZL4="../../../azl-core-legacy-4.0/image.vhd"
165169
fi
166170
167171
TEST_RPMS_DIR="../../toolkit/tools/internal/testutils/testrpms"
@@ -170,8 +174,10 @@ jobs:
170174
IMAGE_CUSTOMIZER_CONTAINER_TAG="$CONTAINER_TAG" \
171175
CORE_EFI_AZL2="../../../azl-core-efi-2.0/image.vhdx" \
172176
CORE_EFI_AZL3="../../../azl-core-efi-3.0/image.vhdx" \
177+
CORE_EFI_AZL4="../../../azl-core-efi-4.0/image.vhdx" \
173178
CORE_LEGACY_AZL2="$CORE_LEGACY_AZL2" \
174179
CORE_LEGACY_AZL3="$CORE_LEGACY_AZL3" \
180+
CORE_LEGACY_AZL4="$CORE_LEGACY_AZL4" \
175181
RPM_SOURCES_AZL3="$TEST_RPMS_DIR/downloadedrpms/azurelinux/3.0" \
176182
RPM_SOURCES_FEDORA42="$TEST_RPMS_DIR/downloadedrpms/fedora/42" \
177183
TOOLS_FILE_AZL3="$TEST_RPMS_DIR/build/tools-azurelinux-3.0.tar.gz" \

test/vmtests/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ test-imagecustomizer:
8888
--logs-dir="${LOGS_DIR}" \
8989
--core-efi-azl2="${CORE_EFI_AZL2}" \
9090
--core-efi-azl3="${CORE_EFI_AZL3}" \
91+
--core-efi-azl4="${CORE_EFI_AZL4}" \
9192
--core-legacy-azl2="${CORE_LEGACY_AZL2}" \
9293
--core-legacy-azl3="${CORE_LEGACY_AZL3}" \
94+
--core-legacy-azl4="${CORE_LEGACY_AZL4}" \
9395
--rpm-sources-azl3="${RPM_SOURCES_AZL3}" \
9496
--rpm-sources-fedora42="${RPM_SOURCES_FEDORA42}" \
9597
--tools-file-azl3="${TOOLS_FILE_AZL3}" \

test/vmtests/vmtests/imagecustomizer/conftest.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99

1010
def pytest_addoption(parser: pytest.Parser) -> None:
11-
# customize subcommand test options (Azure Linux 2/3)
11+
# customize subcommand test options (Azure Linux 2/3/4)
1212
parser.addoption("--core-efi-azl2", action="store", help="Path to Azure Linux 2 core EFI image")
1313
parser.addoption("--core-efi-azl3", action="store", help="Path to Azure Linux 3 core EFI image")
14+
parser.addoption("--core-efi-azl4", action="store", help="Path to Azure Linux 4 core EFI image")
1415
parser.addoption("--core-legacy-azl2", action="store", help="Path to Azure Linux 2 core legacy image")
1516
parser.addoption("--core-legacy-azl3", action="store", help="Path to Azure Linux 3 core legacy image")
17+
parser.addoption("--core-legacy-azl4", action="store", help="Path to Azure Linux 4 core legacy image")
1618

1719
# create subcommand test options (Azure Linux 3 and Fedora 42)
1820
parser.addoption("--rpm-sources-azl3", action="store", help="Path to Azure Linux 3 RPM sources directory")
@@ -37,6 +39,14 @@ def core_efi_azl3(request: pytest.FixtureRequest) -> Generator[Path, None, None]
3739
yield Path(image)
3840

3941

42+
@pytest.fixture(scope="session")
43+
def core_efi_azl4(request: pytest.FixtureRequest) -> Generator[Path, None, None]:
44+
image = request.config.getoption("--core-efi-azl4")
45+
if not image:
46+
pytest.skip("--core-efi-azl4 is required for test")
47+
yield Path(image)
48+
49+
4050
@pytest.fixture(scope="session")
4151
def core_legacy_azl2(request: pytest.FixtureRequest) -> Generator[Path, None, None]:
4252
image = request.config.getoption("--core-legacy-azl2")
@@ -53,6 +63,14 @@ def core_legacy_azl3(request: pytest.FixtureRequest) -> Generator[Path, None, No
5363
yield Path(image)
5464

5565

66+
@pytest.fixture(scope="session")
67+
def core_legacy_azl4(request: pytest.FixtureRequest) -> Generator[Path, None, None]:
68+
image = request.config.getoption("--core-legacy-azl4")
69+
if not image:
70+
pytest.skip("--core-legacy-azl4 is required for test")
71+
yield Path(image)
72+
73+
5674
@pytest.fixture(scope="session")
5775
def rpm_sources_azl3(request: pytest.FixtureRequest) -> Generator[Path, None, None]:
5876
source = request.config.getoption("--rpm-sources-azl3")

test/vmtests/vmtests/imagecustomizer/test_min_change.py

Lines changed: 172 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ def run_basic_checks(
157157
elif input_image_azl_release == 3:
158158
assert "ID=azurelinux" in os_release_text
159159
assert 'VERSION_ID="3.0"' in os_release_text
160+
elif input_image_azl_release == 4:
161+
assert "ID=azurelinux" in os_release_text
162+
assert "VERSION_ID=4.0" in os_release_text
160163
else:
161164
assert False, "Unexpected image identity in /etc/os-release"
162165

@@ -206,9 +209,9 @@ def test_min_change_efi_azl3_qcow_output(
206209
) -> None:
207210
azl_release = 3
208211
if platform.machine() == "x86_64":
209-
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config.yaml")
212+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-amd64-azl3.yaml")
210213
else:
211-
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-arm64.yaml")
214+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-arm64-azl3.yaml")
212215
output_format = "qcow2"
213216

214217
run_min_change_test(
@@ -227,6 +230,40 @@ def test_min_change_efi_azl3_qcow_output(
227230
)
228231

229232

233+
def test_min_change_efi_azl4_qcow_output(
234+
docker_client: DockerClient,
235+
image_customizer_container_url: str,
236+
core_efi_azl4: Path,
237+
ssh_key: Tuple[str, Path],
238+
test_temp_dir: Path,
239+
test_instance_name: str,
240+
logs_dir: Path,
241+
libvirt_conn: libvirt.virConnect,
242+
close_list: List[Closeable],
243+
) -> None:
244+
azl_release = 4
245+
if platform.machine() == "x86_64":
246+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-amd64-azl4.yaml")
247+
else:
248+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-arm64-azl4.yaml")
249+
output_format = "qcow2"
250+
251+
run_min_change_test(
252+
docker_client,
253+
image_customizer_container_url,
254+
core_efi_azl4,
255+
azl_release,
256+
config_path,
257+
output_format,
258+
ssh_key,
259+
test_temp_dir,
260+
test_instance_name,
261+
logs_dir,
262+
libvirt_conn,
263+
close_list,
264+
)
265+
266+
230267
@pytest.mark.skipif(platform.machine() != "x86_64", reason="arm64 is not supported for this combination")
231268
def test_min_change_legacy_azl2_qcow_output(
232269
docker_client: DockerClient,
@@ -272,7 +309,7 @@ def test_min_change_legacy_azl3_qcow_output(
272309
close_list: List[Closeable],
273310
) -> None:
274311
azl_release = 3
275-
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config.yaml")
312+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-amd64-azl3.yaml")
276313
output_format = "qcow2"
277314

278315
run_min_change_test(
@@ -291,6 +328,38 @@ def test_min_change_legacy_azl3_qcow_output(
291328
)
292329

293330

331+
@pytest.mark.skipif(platform.machine() != "x86_64", reason="no arm64 legacy boot input images are available")
332+
def test_min_change_legacy_azl4_qcow_output(
333+
docker_client: DockerClient,
334+
image_customizer_container_url: str,
335+
core_legacy_azl4: Path,
336+
ssh_key: Tuple[str, Path],
337+
test_temp_dir: Path,
338+
test_instance_name: str,
339+
logs_dir: Path,
340+
libvirt_conn: libvirt.virConnect,
341+
close_list: List[Closeable],
342+
) -> None:
343+
azl_release = 4
344+
config_path = TEST_CONFIGS_DIR.joinpath("os-vm-config-amd64-azl4.yaml")
345+
output_format = "qcow2"
346+
347+
run_min_change_test(
348+
docker_client,
349+
image_customizer_container_url,
350+
core_legacy_azl4,
351+
azl_release,
352+
config_path,
353+
output_format,
354+
ssh_key,
355+
test_temp_dir,
356+
test_instance_name,
357+
logs_dir,
358+
libvirt_conn,
359+
close_list,
360+
)
361+
362+
294363
@pytest.mark.skipif(platform.machine() != "x86_64", reason="arm64 is not supported for this combination")
295364
def test_min_change_efi_azl2_iso_output(
296365
docker_client: DockerClient,
@@ -335,7 +404,7 @@ def test_min_change_efi_azl3_iso_bootstrap_output(
335404
close_list: List[Closeable],
336405
) -> None:
337406
azl_release = 3
338-
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm.yaml")
407+
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm-azl3.yaml")
339408
output_format = "iso"
340409

341410
run_min_change_test(
@@ -354,6 +423,38 @@ def test_min_change_efi_azl3_iso_bootstrap_output(
354423
)
355424

356425

426+
@pytest.mark.skip(reason="Azure Linux 4.0 ISO bootstrap output is not yet supported")
427+
def test_min_change_efi_azl4_iso_bootstrap_output(
428+
docker_client: DockerClient,
429+
image_customizer_container_url: str,
430+
core_efi_azl4: Path,
431+
ssh_key: Tuple[str, Path],
432+
test_temp_dir: Path,
433+
test_instance_name: str,
434+
logs_dir: Path,
435+
libvirt_conn: libvirt.virConnect,
436+
close_list: List[Closeable],
437+
) -> None:
438+
azl_release = 4
439+
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm-azl4.yaml")
440+
output_format = "iso"
441+
442+
run_min_change_test(
443+
docker_client,
444+
image_customizer_container_url,
445+
core_efi_azl4,
446+
azl_release,
447+
config_path,
448+
output_format,
449+
ssh_key,
450+
test_temp_dir,
451+
test_instance_name,
452+
logs_dir,
453+
libvirt_conn,
454+
close_list,
455+
)
456+
457+
357458
def test_min_change_efi_azl3_iso_full_os_output(
358459
docker_client: DockerClient,
359460
image_customizer_container_url: str,
@@ -366,7 +467,7 @@ def test_min_change_efi_azl3_iso_full_os_output(
366467
close_list: List[Closeable],
367468
) -> None:
368469
azl_release = 3
369-
config_path = TEST_CONFIGS_DIR.joinpath("iso-full-os-vm.yaml")
470+
config_path = TEST_CONFIGS_DIR.joinpath("iso-full-os-vm-azl3.yaml")
370471
output_format = "iso"
371472

372473
run_min_change_test(
@@ -385,6 +486,38 @@ def test_min_change_efi_azl3_iso_full_os_output(
385486
)
386487

387488

489+
@pytest.mark.skip(reason="Azure Linux 4.0 ISO full OS output is not yet supported")
490+
def test_min_change_efi_azl4_iso_full_os_output(
491+
docker_client: DockerClient,
492+
image_customizer_container_url: str,
493+
core_efi_azl4: Path,
494+
ssh_key: Tuple[str, Path],
495+
test_temp_dir: Path,
496+
test_instance_name: str,
497+
logs_dir: Path,
498+
libvirt_conn: libvirt.virConnect,
499+
close_list: List[Closeable],
500+
) -> None:
501+
azl_release = 4
502+
config_path = TEST_CONFIGS_DIR.joinpath("iso-full-os-vm-azl4.yaml")
503+
output_format = "iso"
504+
505+
run_min_change_test(
506+
docker_client,
507+
image_customizer_container_url,
508+
core_efi_azl4,
509+
azl_release,
510+
config_path,
511+
output_format,
512+
ssh_key,
513+
test_temp_dir,
514+
test_instance_name,
515+
logs_dir,
516+
libvirt_conn,
517+
close_list,
518+
)
519+
520+
388521
@pytest.mark.skipif(platform.machine() != "x86_64", reason="arm64 is not supported for this combination")
389522
def test_min_change_legacy_azl2_iso_output(
390523
docker_client: DockerClient,
@@ -430,7 +563,7 @@ def test_min_change_legacy_azl3_iso_output(
430563
close_list: List[Closeable],
431564
) -> None:
432565
azl_release = 3
433-
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm.yaml")
566+
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm-azl3.yaml")
434567
output_format = "iso"
435568

436569
run_min_change_test(
@@ -447,3 +580,36 @@ def test_min_change_legacy_azl3_iso_output(
447580
libvirt_conn,
448581
close_list,
449582
)
583+
584+
585+
@pytest.mark.skipif(platform.machine() != "x86_64", reason="no arm64 legacy boot input images are available")
586+
@pytest.mark.skip(reason="Azure Linux 4.0 ISO bootstrap output is not yet supported")
587+
def test_min_change_legacy_azl4_iso_output(
588+
docker_client: DockerClient,
589+
image_customizer_container_url: str,
590+
core_legacy_azl4: Path,
591+
ssh_key: Tuple[str, Path],
592+
test_temp_dir: Path,
593+
test_instance_name: str,
594+
logs_dir: Path,
595+
libvirt_conn: libvirt.virConnect,
596+
close_list: List[Closeable],
597+
) -> None:
598+
azl_release = 4
599+
config_path = TEST_CONFIGS_DIR.joinpath("iso-bootstrap-vm-azl4.yaml")
600+
output_format = "iso"
601+
602+
run_min_change_test(
603+
docker_client,
604+
image_customizer_container_url,
605+
core_legacy_azl4,
606+
azl_release,
607+
config_path,
608+
output_format,
609+
ssh_key,
610+
test_temp_dir,
611+
test_instance_name,
612+
logs_dir,
613+
libvirt_conn,
614+
close_list,
615+
)

toolkit/tools/pkg/imagecustomizerlib/testdata/iso-bootstrap-vm.yaml renamed to toolkit/tools/pkg/imagecustomizerlib/testdata/iso-bootstrap-vm-azl3.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
iso:
22
initramfsType: bootstrap
3+
34
os:
45
selinux:
56
mode: enforcing
7+
68
packages:
79
install:
810
# multi-kernel test
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Differs from iso-bootstrap-vm-azl3 in the kernel version and its removal of selinux-policy-modules
2+
iso:
3+
initramfsType: bootstrap
4+
5+
os:
6+
selinux:
7+
mode: enforcing
8+
9+
packages:
10+
install:
11+
# multi-kernel test
12+
- kernel-6.18.5-1.8.azl4~20260420
13+
# iso required packages
14+
- squashfs-tools
15+
- tar
16+
- device-mapper
17+
- curl
18+
# Required package for SELinux.
19+
- selinux-policy
20+
21+
additionalFiles:
22+
# Enable DHCP client on all of the physical NICs.
23+
- source: files/89-ethernet.network
24+
destination: /etc/systemd/network/89-ethernet.network

toolkit/tools/pkg/imagecustomizerlib/testdata/iso-full-os-vm.yaml renamed to toolkit/tools/pkg/imagecustomizerlib/testdata/iso-full-os-vm-azl3.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
iso:
22
initramfsType: full-os
3+
34
os:
45
selinux:
56
mode: disabled
7+
68
kernelCommandLine:
79
extraCommandLine:
810
- "selinux=0"
11+
912
packages:
1013
install:
1114
# multi-kernel test

0 commit comments

Comments
 (0)