Skip to content

Commit 0861767

Browse files
pb8otommady
authored andcommitted
tests: simplify rootfs fixture
Since we only have one rootfs, simplify the fixture to return a single value. This will have also not show it as part of the test instance name. Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent c237b11 commit 0861767

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

tests/conftest.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
import host_tools.cargo_build as build_tools
3737
from framework import defs, utils
38-
from framework.artifacts import kernel_params, rootfs_params
38+
from framework.artifacts import disks, kernel_params
3939
from framework.microvm import MicroVMFactory
4040
from framework.properties import global_props
4141
from framework.utils_cpu_templates import (
@@ -354,13 +354,6 @@ def guest_kernel_fxt(request, record_property):
354354
return kernel
355355

356356

357-
def rootfs_fxt(request, record_property):
358-
"""Return all supported rootfs."""
359-
fs = request.param
360-
record_property("rootfs", fs.name)
361-
return fs
362-
363-
364357
# Fixtures for all guest kernels, and specific versions
365358
guest_kernel = pytest.fixture(guest_kernel_fxt, params=kernel_params("vmlinux-*"))
366359
guest_kernel_acpi = pytest.fixture(
@@ -380,9 +373,17 @@ def rootfs_fxt(request, record_property):
380373
params=kernel_params("vmlinux-6.1*"),
381374
)
382375

383-
# Fixtures for all Ubuntu rootfs, and specific versions
384-
rootfs = pytest.fixture(rootfs_fxt, params=rootfs_params("ubuntu-24*.squashfs"))
385-
rootfs_rw = pytest.fixture(rootfs_fxt, params=rootfs_params("*.ext4"))
376+
377+
@pytest.fixture
378+
def rootfs():
379+
"""Return an Ubuntu 24.04 read-only rootfs"""
380+
return disks("ubuntu-24.04.squashfs")[0]
381+
382+
383+
@pytest.fixture
384+
def rootfs_rw():
385+
"""Return an Ubuntu 24.04 ext4 rootfs"""
386+
return disks("ubuntu-24.04.ext4")[0]
386387

387388

388389
@pytest.fixture

tests/framework/artifacts.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def kernels(glob, artifact_dir: Path = ARTIFACT_DIR) -> Iterator:
4444
break
4545

4646

47-
def disks(glob) -> Iterator:
47+
def disks(glob) -> list:
4848
"""Return supported rootfs"""
49-
yield from sorted(ARTIFACT_DIR.glob(glob))
49+
return sorted(ARTIFACT_DIR.glob(glob))
5050

5151

5252
def kernel_params(
@@ -57,12 +57,6 @@ def kernel_params(
5757
yield pytest.param(kernel, id=kernel.name)
5858

5959

60-
def rootfs_params(glob="ubuntu-*.squashfs") -> Iterator:
61-
"""Return supported rootfs as pytest parameters"""
62-
for rootfs in disks(glob=glob):
63-
yield pytest.param(rootfs, id=rootfs.name)
64-
65-
6660
@dataclass(frozen=True, repr=True)
6761
class FirecrackerArtifact:
6862
"""Utility class for Firecracker binary artifacts."""

0 commit comments

Comments
 (0)