Skip to content

Commit 1bb4f4c

Browse files
committed
test: drop ubuntu version from rootfs fixture name
It is unlikely that we will ever support more than one rootfs. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 181619a commit 1bb4f4c

13 files changed

+62
-83
lines changed

tests/conftest.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,20 +388,17 @@ def rootfs_fxt(request, record_property):
388388
)
389389

390390
# Fixtures for all Ubuntu rootfs, and specific versions
391-
rootfs = pytest.fixture(rootfs_fxt, params=rootfs_params("*.squashfs"))
392-
rootfs_ubuntu_24 = pytest.fixture(
393-
rootfs_fxt, params=rootfs_params("ubuntu-24*.squashfs")
394-
)
391+
rootfs = pytest.fixture(rootfs_fxt, params=rootfs_params("ubuntu-24*.squashfs"))
395392
rootfs_rw = pytest.fixture(rootfs_fxt, params=rootfs_params("*.ext4"))
396393

397394

398395
@pytest.fixture
399-
def uvm_plain(microvm_factory, guest_kernel_linux_5_10, rootfs_ubuntu_24):
396+
def uvm_plain(microvm_factory, guest_kernel_linux_5_10, rootfs):
400397
"""Create a vanilla VM, non-parametrized
401398
kernel: 5.10
402399
rootfs: Ubuntu 24.04
403400
"""
404-
return microvm_factory.build(guest_kernel_linux_5_10, rootfs_ubuntu_24)
401+
return microvm_factory.build(guest_kernel_linux_5_10, rootfs)
405402

406403

407404
@pytest.fixture
@@ -430,12 +427,12 @@ def artifact_dir():
430427

431428

432429
@pytest.fixture
433-
def uvm_plain_any(microvm_factory, guest_kernel, rootfs_ubuntu_24):
430+
def uvm_plain_any(microvm_factory, guest_kernel, rootfs):
434431
"""All guest kernels
435432
kernel: all
436433
rootfs: Ubuntu 24.04
437434
"""
438-
return microvm_factory.build(guest_kernel, rootfs_ubuntu_24)
435+
return microvm_factory.build(guest_kernel, rootfs)
439436

440437

441438
guest_kernel_6_1_debug = pytest.fixture(

tests/integration_tests/functional/test_cpu_features_aarch64.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ def test_host_vs_guest_cpu_features_aarch64(uvm_nano):
148148
PLATFORM != "aarch64",
149149
reason="This is aarch64 specific test.",
150150
)
151-
def test_default_cpu_features(microvm_factory, guest_kernel, rootfs_ubuntu_24):
151+
def test_default_cpu_features(microvm_factory, guest_kernel, rootfs):
152152
"""
153153
Check the CPU features for a microvm with the specified config.
154154
"""
155155

156-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
156+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
157157
vm.spawn()
158158
vm.basic_config()
159159
vm.add_net_iface()
@@ -167,13 +167,13 @@ def test_default_cpu_features(microvm_factory, guest_kernel, rootfs_ubuntu_24):
167167
reason="This is aarch64 specific test.",
168168
)
169169
def test_cpu_features_with_static_template(
170-
microvm_factory, guest_kernel, rootfs_ubuntu_24, cpu_template
170+
microvm_factory, guest_kernel, rootfs, cpu_template
171171
):
172172
"""
173173
Check the CPU features for a microvm with the specified config.
174174
"""
175175

176-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
176+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
177177
vm.spawn()
178178
vm.basic_config(cpu_template=cpu_template)
179179
vm.add_net_iface()
@@ -195,13 +195,13 @@ def test_cpu_features_with_static_template(
195195
reason="This is aarch64 specific test.",
196196
)
197197
def test_cpu_features_with_custom_template(
198-
microvm_factory, guest_kernel, rootfs_ubuntu_24, custom_cpu_template
198+
microvm_factory, guest_kernel, rootfs, custom_cpu_template
199199
):
200200
"""
201201
Check the CPU features for a microvm with the specified config.
202202
"""
203203

204-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
204+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
205205
vm.spawn()
206206
vm.basic_config()
207207
vm.api.cpu_config.put(**custom_cpu_template["template"])

tests/integration_tests/functional/test_cpu_features_x86_64.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def msr_cpu_template_fxt(request):
560560
@pytest.mark.timeout(900)
561561
@pytest.mark.nonci
562562
def test_cpu_rdmsr(
563-
microvm_factory, msr_cpu_template, guest_kernel, rootfs_ubuntu_24, results_dir
563+
microvm_factory, msr_cpu_template, guest_kernel, rootfs, results_dir
564564
):
565565
"""
566566
Test MSRs that are available to the guest.
@@ -595,7 +595,7 @@ def test_cpu_rdmsr(
595595
"""
596596

597597
vcpus, guest_mem_mib = 1, 1024
598-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
598+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
599599
vm.spawn()
600600
vm.add_net_iface()
601601
vm.basic_config(
@@ -664,9 +664,7 @@ def dump_msr_state_to_file(dump_fname, ssh_conn, shared_names):
664664
)
665665
@pytest.mark.timeout(900)
666666
@pytest.mark.nonci
667-
def test_cpu_wrmsr_snapshot(
668-
microvm_factory, guest_kernel, rootfs_ubuntu_24, msr_cpu_template
669-
):
667+
def test_cpu_wrmsr_snapshot(microvm_factory, guest_kernel, rootfs, msr_cpu_template):
670668
"""
671669
This is the first part of the test verifying
672670
that MSRs retain their values after restoring from a snapshot.
@@ -686,7 +684,7 @@ def test_cpu_wrmsr_snapshot(
686684
shared_names = SNAPSHOT_RESTORE_SHARED_NAMES
687685

688686
vcpus, guest_mem_mib = 1, 1024
689-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
687+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
690688
vm.spawn()
691689
vm.add_net_iface()
692690
vm.basic_config(
@@ -821,9 +819,7 @@ def dump_cpuid_to_file(dump_fname, ssh_conn):
821819
)
822820
@pytest.mark.timeout(900)
823821
@pytest.mark.nonci
824-
def test_cpu_cpuid_snapshot(
825-
microvm_factory, guest_kernel, rootfs_ubuntu_24, msr_cpu_template
826-
):
822+
def test_cpu_cpuid_snapshot(microvm_factory, guest_kernel, rootfs, msr_cpu_template):
827823
"""
828824
This is the first part of the test verifying
829825
that CPUID remains the same after restoring from a snapshot.
@@ -839,7 +835,7 @@ def test_cpu_cpuid_snapshot(
839835

840836
vm = microvm_factory.build(
841837
kernel=guest_kernel,
842-
rootfs=rootfs_ubuntu_24,
838+
rootfs=rootfs,
843839
)
844840
vm.spawn()
845841
vm.add_net_iface()

tests/integration_tests/functional/test_drive_vhost_user.py

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _check_drives(test_microvm, assert_dict, keys_array):
3434
assert blockdev_out_line_cols[col] == assert_dict[key]
3535

3636

37-
def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
37+
def test_vhost_user_block(microvm_factory, guest_kernel, rootfs):
3838
"""
3939
This test simply tries to boot a VM with
4040
vhost-user-block as a root device.
@@ -44,13 +44,11 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
4444

4545
# We need to setup ssh keys manually because we did not specify rootfs
4646
# in microvm_factory.build method
47-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
47+
ssh_key = rootfs.with_suffix(".id_rsa")
4848
vm.ssh_key = ssh_key
4949
vm.spawn()
5050
vm.basic_config(add_root_device=False)
51-
vm.add_vhost_user_drive(
52-
"rootfs", rootfs_ubuntu_24, is_root_device=True, is_read_only=True
53-
)
51+
vm.add_vhost_user_drive("rootfs", rootfs, is_root_device=True, is_read_only=True)
5452
vm.add_net_iface()
5553
vhost_user_block_metrics = FcDeviceMetrics(
5654
"vhost_user_block", 1, aggr_supported=False
@@ -67,7 +65,7 @@ def test_vhost_user_block(microvm_factory, guest_kernel, rootfs_ubuntu_24):
6765
vhost_user_block_metrics.validate(vm)
6866

6967

70-
def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubuntu_24):
68+
def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs):
7169
"""
7270
This test simply tries to boot a VM with
7371
vhost-user-block as a root device.
@@ -78,14 +76,14 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
7876

7977
# We need to setup ssh keys manually because we did not specify rootfs
8078
# in microvm_factory.build method
81-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
79+
ssh_key = rootfs.with_suffix(".id_rsa")
8280
vm.ssh_key = ssh_key
8381
vm.spawn()
8482
vm.basic_config(add_root_device=False)
8583

8684
# Create a rw rootfs file that is unique to the microVM
8785
rootfs_rw = Path(vm.chroot()) / "rootfs"
88-
shutil.copy(rootfs_ubuntu_24, rootfs_rw)
86+
shutil.copy(rootfs, rootfs_rw)
8987

9088
vm.add_vhost_user_drive("rootfs", rootfs_rw, is_root_device=True)
9189
vm.add_net_iface()
@@ -100,7 +98,7 @@ def test_vhost_user_block_read_write(microvm_factory, guest_kernel, rootfs_ubunt
10098
_check_drives(vm, assert_dict, assert_dict.keys())
10199

102100

103-
def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubuntu_24):
101+
def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs):
104102
"""
105103
Test that even if backend is killed, Firecracker is still responsive.
106104
"""
@@ -109,13 +107,11 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
109107

110108
# We need to set up ssh keys manually because we did not specify rootfs
111109
# in microvm_factory.build method
112-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
110+
ssh_key = rootfs.with_suffix(".id_rsa")
113111
vm.ssh_key = ssh_key
114112
vm.spawn()
115113
vm.basic_config(add_root_device=False)
116-
vm.add_vhost_user_drive(
117-
"rootfs", rootfs_ubuntu_24, is_root_device=True, is_read_only=True
118-
)
114+
vm.add_vhost_user_drive("rootfs", rootfs, is_root_device=True, is_read_only=True)
119115
vm.add_net_iface()
120116
vm.start()
121117

@@ -127,7 +123,7 @@ def test_vhost_user_block_disconnect(microvm_factory, guest_kernel, rootfs_ubunt
127123
_config = vm.api.vm_config.get().json()
128124

129125

130-
def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
126+
def test_device_ordering(microvm_factory, guest_kernel, rootfs):
131127
"""
132128
Verify device ordering.
133129
@@ -139,7 +135,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
139135

140136
# We need to setup ssh keys manually because we did not specify rootfs
141137
# in microvm_factory.build method
142-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
138+
ssh_key = rootfs.with_suffix(".id_rsa")
143139
vm.ssh_key = ssh_key
144140
vm.spawn()
145141
vm.basic_config(add_root_device=False)
@@ -150,17 +146,15 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
150146
vm.add_drive("scratch1", fs1.path)
151147

152148
# Adding second block device (rootfs)
153-
vm.add_vhost_user_drive(
154-
"rootfs", rootfs_ubuntu_24, is_root_device=True, is_read_only=True
155-
)
149+
vm.add_vhost_user_drive("rootfs", rootfs, is_root_device=True, is_read_only=True)
156150

157151
# Adding third block device.
158152
fs2 = drive_tools.FilesystemFile(os.path.join(vm.fsfiles, "scratch2"), size=512)
159153
vm.add_drive("scratch2", fs2.path)
160154

161155
# Create a rw rootfs file that is unique to the microVM
162156
rootfs_rw = Path(vm.chroot()) / "rootfs"
163-
shutil.copy(rootfs_ubuntu_24, rootfs_rw)
157+
shutil.copy(rootfs, rootfs_rw)
164158

165159
# Adding forth block device.
166160
vm.add_vhost_user_drive("dummy_rootfs", rootfs_rw)
@@ -171,7 +165,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
171165
)
172166
vm.start()
173167

174-
rootfs_size = rootfs_ubuntu_24.stat().st_size
168+
rootfs_size = rootfs.stat().st_size
175169

176170
# The devices were added in this order: fs1, rootfs, fs2. fs3
177171
# However, the rootfs is the root device and goes first,
@@ -203,7 +197,7 @@ def test_device_ordering(microvm_factory, guest_kernel, rootfs_ubuntu_24):
203197
def test_partuuid_boot(
204198
microvm_factory,
205199
guest_kernel,
206-
rootfs_ubuntu_24,
200+
rootfs,
207201
):
208202
"""
209203
Test the output reported by blockdev when booting with PARTUUID.
@@ -213,15 +207,13 @@ def test_partuuid_boot(
213207

214208
# We need to setup ssh keys manually because we did not specify rootfs
215209
# in microvm_factory.build method
216-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
210+
ssh_key = rootfs.with_suffix(".id_rsa")
217211
vm.ssh_key = ssh_key
218212
vm.spawn()
219213
vm.basic_config(add_root_device=False)
220214

221215
# Create a rootfs with partuuid unique to this microVM
222-
partuuid, disk_path = partuuid_and_disk_path(
223-
rootfs_ubuntu_24, Path(vm.chroot()) / "disk.img"
224-
)
216+
partuuid, disk_path = partuuid_and_disk_path(rootfs, Path(vm.chroot()) / "disk.img")
225217

226218
vm.add_vhost_user_drive(
227219
"1", disk_path, is_root_device=True, partuuid=partuuid, is_read_only=True
@@ -238,7 +230,7 @@ def test_partuuid_boot(
238230
_check_drives(vm, assert_dict, assert_dict.keys())
239231

240232

241-
def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
233+
def test_partuuid_update(microvm_factory, guest_kernel, rootfs):
242234
"""
243235
Test successful switching from PARTUUID boot to /dev/vda boot.
244236
"""
@@ -247,7 +239,7 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
247239

248240
# We need to setup ssh keys manually because we did not specify rootfs
249241
# in microvm_factory.build method
250-
ssh_key = rootfs_ubuntu_24.with_suffix(".id_rsa")
242+
ssh_key = rootfs.with_suffix(".id_rsa")
251243
vm.ssh_key = ssh_key
252244
vm.spawn()
253245
vm.basic_config(add_root_device=False)
@@ -256,16 +248,14 @@ def test_partuuid_update(microvm_factory, guest_kernel, rootfs_ubuntu_24):
256248
# Add the root block device specified through PARTUUID.
257249
vm.add_vhost_user_drive(
258250
"rootfs",
259-
rootfs_ubuntu_24,
251+
rootfs,
260252
is_root_device=True,
261253
partuuid="0eaa91a0-01",
262254
is_read_only=True,
263255
)
264256

265257
# Adding a drive with the same ID creates another backend with another socket.
266-
vm.add_vhost_user_drive(
267-
"rootfs", rootfs_ubuntu_24, is_root_device=True, is_read_only=True
268-
)
258+
vm.add_vhost_user_drive("rootfs", rootfs, is_root_device=True, is_read_only=True)
269259

270260
vhost_user_block_metrics = FcDeviceMetrics(
271261
"vhost_user_block", 1, aggr_supported=False

tests/integration_tests/functional/test_drive_virtio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515

1616
@pytest.fixture
17-
def partuuid_and_disk_path_tmpfs(rootfs_ubuntu_24, tmp_path):
17+
def partuuid_and_disk_path_tmpfs(rootfs, tmp_path):
1818
"""
1919
We create a new file in tmpfs, get its partuuid and use it as a rootfs.
2020
"""
2121
disk_path = tmp_path / "disk.img"
22-
yield partuuid_and_disk_path(rootfs_ubuntu_24, disk_path)
22+
yield partuuid_and_disk_path(rootfs, disk_path)
2323
disk_path.unlink()
2424

2525

tests/integration_tests/functional/test_net.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ def test_tap_offload_booted(uvm_plain_any):
127127
run_udp_offload_test(vm)
128128

129129

130-
def test_tap_offload_restored(microvm_factory, guest_kernel, rootfs_ubuntu_24):
130+
def test_tap_offload_restored(microvm_factory, guest_kernel, rootfs):
131131
"""
132132
Verify that tap offload features are configured for a restored VM.
133133
"""
134-
src = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
134+
src = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
135135
src.spawn()
136136
src.basic_config()
137137
src.add_net_iface()

tests/integration_tests/functional/test_snapshot_not_losing_dirty_pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def mount_tmpfs_small(worker_id):
2525

2626

2727
def test_diff_snapshot_works_after_error(
28-
microvm_factory, guest_kernel_linux_5_10, rootfs_ubuntu_24, mount_tmpfs_small
28+
microvm_factory, guest_kernel_linux_5_10, rootfs, mount_tmpfs_small
2929
):
3030
"""
3131
Test that if a partial snapshot errors it will work after and not lose data
3232
"""
3333
uvm = microvm_factory.build(
3434
guest_kernel_linux_5_10,
35-
rootfs_ubuntu_24,
35+
rootfs,
3636
jailer_kwargs={"chroot_base": mount_tmpfs_small},
3737
)
3838

tests/integration_tests/functional/test_snapshot_phase1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
@pytest.mark.nonci
2929
def test_snapshot_phase1(
30-
microvm_factory, guest_kernel, rootfs_ubuntu_24, cpu_template_any, results_dir
30+
microvm_factory, guest_kernel, rootfs, cpu_template_any, results_dir
3131
):
3232
"""Create a snapshot and save it to disk"""
3333

34-
vm = microvm_factory.build(guest_kernel, rootfs_ubuntu_24, monitor_memory=False)
34+
vm = microvm_factory.build(guest_kernel, rootfs, monitor_memory=False)
3535
vm.spawn(log_level="Info")
3636
vm.add_net_iface()
3737

0 commit comments

Comments
 (0)