Skip to content

Commit 6ec5511

Browse files
JamesC1305Manciukic
authored andcommitted
fix(tests): do not construct GuestDistro for docker-popular
We saw failures on the docker popular tests because it was trying to create a GuestDistro instance but could not find a matching entry. In reality, we don't need this object for the docker popular tests, so just return None if it's not AL2023 or Ubuntu. Signed-off-by: James Curtis <[email protected]>
1 parent 1ab82e3 commit 6ec5511

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/framework/guest.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
from dataclasses import dataclass
77
from pathlib import Path
8+
from typing import Optional
89

910

1011
@dataclass(frozen=True)
@@ -17,8 +18,8 @@ class GuestDistro:
1718
shell_prompt: str
1819

1920
@classmethod
20-
def from_rootfs(cls, rootfs_path: Path) -> "GuestDistro":
21-
"""Return a guest distro object based on the rootfs name"""
21+
def from_rootfs(cls, rootfs_path: Path) -> Optional["GuestDistro"]:
22+
"""Return a guest distro object based on the rootfs name, or None if unrecognized."""
2223
name = rootfs_path.stem.lower()
2324
if "ubuntu" in name:
2425
hostname = "ubuntu-fc-uvm"
@@ -36,4 +37,4 @@ def from_rootfs(cls, rootfs_path: Path) -> "GuestDistro":
3637
os_release_token='ID="amzn"',
3738
shell_prompt=f"[root@{hostname} ~]#",
3839
)
39-
raise ValueError(f"Unknown guest distro for rootfs: {rootfs_path}")
40+
return None

0 commit comments

Comments
 (0)