Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tests/test_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
LINUX_INSTALLER_REMEDY = re.compile(r"^host-setup/linux/install-tools\.sh --upgrade (\S+)$")
WINDOWS_INSTALLER_REMEDY = re.compile(r"^host-setup/windows/install-tools\.ps1 -Upgrade (\S+)$")

RUNS_LINUX_INSTALLER = unittest.skipUnless(
sys.platform == "linux", "executes install-tools.sh, which only a Linux host can run"
)

# A spec tool an installer deliberately does not manage, and the reason, recorded so an omission is a decision somebody made rather than one nobody noticed.
# Both sets are empty, which is itself the assertion: docker installs the same way on a hypervisor and a workstation on both platforms now, and the one case that differs, a WSL distribution, is handled inside install-tools.sh itself (it skips the native install and points at Docker Desktop's own WSL integration) rather than by leaving docker unmanaged on Linux entirely.
NOT_MANAGED: dict[str, dict[str, str]] = {
Expand Down Expand Up @@ -240,6 +244,7 @@ def test_ripgrep_uses_the_platform_package_managers(self) -> None:
r"Name = 'ripgrep'; Package = 'BurntSushi\.ripgrep\.MSVC'; Probe = 'rg'",
)

@RUNS_LINUX_INSTALLER
def test_linux_installer_lists_a_repository_apt_package(self) -> None:
"""A repository package joins the managed set without becoming executable text."""
declaration = {
Expand All @@ -263,6 +268,7 @@ def test_linux_installer_lists_a_repository_apt_package(self) -> None:
self.assertIn("virt-customize", result.stdout)
self.assertIn("apt:libguestfs-tools (repository)", result.stdout)

@RUNS_LINUX_INSTALLER
def test_linux_installer_rejects_a_repository_collision(self) -> None:
"""Repository metadata cannot replace a fleet tool's specialized installer."""
declaration = {
Expand All @@ -285,6 +291,7 @@ def test_linux_installer_rejects_a_repository_collision(self) -> None:
self.assertNotEqual(result.returncode, 0)
self.assertIn("cannot replace it", result.stderr)

@RUNS_LINUX_INSTALLER
def test_linux_installer_rejects_duplicate_repository_names(self) -> None:
"""Duplicate overlay names are ambiguous and fail before selection."""
entry = {
Expand All @@ -305,6 +312,7 @@ def test_linux_installer_rejects_duplicate_repository_names(self) -> None:
self.assertNotEqual(result.returncode, 0)
self.assertIn("more than once", result.stderr)

@RUNS_LINUX_INSTALLER
def test_linux_installer_rejects_an_unnamed_repository_tool(self) -> None:
"""Malformed applicable metadata fails instead of disappearing from the catalog."""
declaration = {
Expand All @@ -322,6 +330,7 @@ def test_linux_installer_rejects_an_unnamed_repository_tool(self) -> None:
self.assertNotEqual(result.returncode, 0)
self.assertIn("Cannot read constrained Linux install metadata", result.stderr)

@RUNS_LINUX_INSTALLER
def test_linux_installer_rejects_a_non_string_package(self) -> None:
"""JSON scalars do not become package identifiers through jq stringification."""
declaration = {
Expand All @@ -344,6 +353,7 @@ def test_linux_installer_rejects_a_non_string_package(self) -> None:
self.assertNotEqual(result.returncode, 0)
self.assertIn("Cannot read constrained Linux install metadata", result.stderr)

@RUNS_LINUX_INSTALLER
def test_linux_installer_rejects_extra_install_metadata(self) -> None:
"""The runtime trust boundary matches the schema's closed package object."""
declaration = {
Expand Down
Loading