Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

fix(extensions): don't offer extensions whose image this host cannot run (#8265)

Mike Bradleya59d5364f94e
diff --git a/ods/config/extensions-catalog.json b/ods/config/extensions-catalog.json
index d51c87899..b733a4769 100644
--- a/ods/config/extensions-catalog.json
+++ b/ods/config/extensions-catalog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-10-26T00:13:51Z",
+ "generated_at": "2026-10-27T08:46:30Z",
"schema_version": "1.0.0",
"extensions": [
{
@@ -2544,6 +2544,11 @@
}
}
],
+ "host_requirements": {
+ "architectures": [
+ "amd64"
+ ]
+ },
"startup_check": true,
"startup_timeout": 600,
"catalog_source": "builtin",
@@ -8887,6 +8892,9 @@
"env_vars": [],
"tags": [],
"features": [],
+ "host_requirements": {
+ "max_page_size": 4096
+ },
"ui_path": "/dashboard",
"catalog_source": "builtin",
"configuration_scope": "declared-environment-keys"
diff --git a/ods/docs/EXTENSIONS.md b/ods/docs/EXTENSIONS.md
index 8f2f276ef..28e5a4e0f 100644
--- a/ods/docs/EXTENSIONS.md
+++ b/ods/docs/EXTENSIONS.md
@@ -290,7 +290,8 @@ Optional root field:
Service section:
- required: `id`, `name`, `port`, `health`
- recommended: `aliases`, `container_name`, `compose_file`, `category`, `depends_on`
-- optional: `host_env`, `default_host`, `external_port_env`, `external_port_default`, `type`, `gpu_backends`, `env_vars`
+- optional: `host_env`, `default_host`, `external_port_env`, `external_port_default`, `type`, `gpu_backends`, `env_vars`, `host_requirements`
+- `host_requirements` — for an image upstream does not build for every host: `architectures` (`amd64`, `arm64`) and `max_page_size` (bytes, e.g. `4096` for a jemalloc built for 4 KB pages). On a Linux host outside them the Dashboard marks the extension incompatible and refuses to prepare or enable it, and the Compose resolver leaves it out of the stack. Docker Desktop on macOS runs amd64 images under Rosetta 2 in a 4 KB-page VM, so they do not apply there.
Feature section (optional list):
- required per feature: `id`, `name`, `description`, `icon`, `category`, `requirements`, `priority`
diff --git a/ods/extensions/library/schema/service-manifest.v1.json b/ods/extensions/library/schema/service-manifest.v1.json
index 87da27f3e..aee44d949 100644
--- a/ods/extensions/library/schema/service-manifest.v1.json
+++ b/ods/extensions/library/schema/service-manifest.v1.json
@@ -142,6 +142,26 @@
"items": { "type": "string", "enum": ["amd", "nvidia", "apple", "cpu", "none", "all"] },
"minItems": 1
},
+ "host_requirements": {
+ "type": "object",
+ "description": "Hosts the service's image can run on, for an image upstream does not build for every CPU architecture or kernel page size. Outside them the Dashboard marks the service incompatible and refuses to prepare or enable it. Docker Desktop on macOS runs amd64 images under Rosetta 2, so architectures do not apply there.",
+ "properties": {
+ "architectures": {
+ "type": "array",
+ "items": { "type": "string", "enum": ["amd64", "arm64"] },
+ "minItems": 1,
+ "uniqueItems": true,
+ "description": "Docker architectures the image runs on natively."
+ },
+ "max_page_size": {
+ "type": "integer",
+ "enum": [4096, 16384, 65536],
+ "description": "Largest kernel page size, in bytes, the image runs with (4096 for a jemalloc built for 4 KB pages)."
+ }
+ },
+ "minProperties": 1,
+ "additionalProperties": false
+ },
"compose_file": {
"type": "string",
"description": "Relative path to compose fragment (e.g. compose.yaml)"
diff --git a/ods/extensions/schema/service-manifest.v1.json b/ods/extensions/schema/service-manifest.v1.json
index 87da27f3e..aee44d949 100644
--- a/ods/extensions/schema/service-manifest.v1.json
+++ b/ods/extensions/schema/service-manifest.v1.json
@@ -142,6 +142,26 @@
"items": { "type": "string", "enum": ["amd", "nvidia", "apple", "cpu", "none", "all"] },
"minItems": 1
},
+ "host_requirements": {
+ "type": "object",
+ "description": "Hosts the service's image can run on, for an image upstream does not build for every CPU architecture or kernel page size. Outside them the Dashboard marks the service incompatible and refuses to prepare or enable it. Docker Desktop on macOS runs amd64 images under Rosetta 2, so architectures do not apply there.",
+ "properties": {
+ "architectures": {
+ "type": "array",
+ "items": { "type": "string", "enum": ["amd64", "arm64"] },
+ "minItems": 1,
+ "uniqueItems": true,
+ "description": "Docker architectures the image runs on natively."
+ },
+ "max_page_size": {
+ "type": "integer",
+ "enum": [4096, 16384, 65536],
+ "description": "Largest kernel page size, in bytes, the image runs with (4096 for a jemalloc built for 4 KB pages)."
+ }
+ },
+ "minProperties": 1,
+ "additionalProperties": false
+ },
"compose_file": {
"type": "string",
"description": "Relative path to compose fragment (e.g. compose.yaml)"
diff --git a/ods/extensions/services/dashboard-api/extension_catalog_local.py b/ods/extensions/services/dashboard-api/extension_catalog_local.py
index 38edaf88c..7b5df0dac 100644
--- a/ods/extensions/services/dashboard-api/extension_catalog_local.py
+++ b/ods/extensions/services/dashboard-api/extension_catalog_local.py
@@ -50,7 +50,8 @@ def merge_local_catalog(catalog, directory, schema_path, *, proposals_only=False
continue
entry = {key: service[key] for key in (
'id', 'name', 'description', 'category', 'gpu_backends', 'compose_file',
- 'depends_on', 'port', 'external_port_default', 'startup_check', 'startup_timeout'
+ 'depends_on', 'port', 'external_port_default', 'startup_check', 'startup_timeout',
+ 'host_requirements',
) if key in service}
entry.setdefault('description', '')
entry.setdefault('category', 'optional')
diff --git a/ods/extensions/services/dashboard-api/routers/extensions.py b/ods/extensions/services/dashboard-api/routers/extensions.py
index 7ab3eae19..f0531c98f 100644
--- a/ods/extensions/services/dashboard-api/routers/extensions.py
+++ b/ods/extensions/services/dashboard-api/routers/extensions.py
@@ -5,7 +5,9 @@ import contextlib
import hashlib
import json
import logging
+import mmap
import os
+import platform
import re
import shutil
import stat
@@ -506,6 +508,33 @@ def _gpu_compatible(ext: dict) -> bool:
return not gpu_backends or "all" in gpu_backends or GPU_BACKEND in gpu_backends
+# Containers share the host kernel, so this API sees the Docker host's CPU
+# architecture and page size.
+_HOST_ARCH = {"x86_64": "amd64", "aarch64": "arm64"}.get(platform.machine().lower(), platform.machine().lower())
+_HOST_PAGE_SIZE = mmap.PAGESIZE
+
+
+def _host_unsupported_reason(ext: dict) -> str:
+ """Why this host cannot run the entry's image, or "" when it can.
+
+ Some upstream images exist for one CPU architecture, or abort on kernel
+ pages larger than 4 KB; on Workstation06 (arm64, 64 KB pages) they
+ crash-looped after an enable (#8257). Docker Desktop on macOS runs amd64
+ images under Rosetta 2, so architectures do not apply there.
+ """
+ requirements = ext.get("host_requirements")
+ if not isinstance(requirements, dict):
+ return ""
+ name = ext.get("name") or ext.get("id", "This extension")
+ architectures = requirements.get("architectures")
+ if isinstance(architectures, list) and GPU_BACKEND != "apple" and _HOST_ARCH not in architectures:
+ return f"{name}'s image is built for {' and '.join(architectures)} only; this machine is {_HOST_ARCH}."
+ max_page_size = requirements.get("max_page_size")
+ if type(max_page_size) is int and _HOST_PAGE_SIZE > max_page_size:
+ return f"{name}'s image cannot run with this machine's {_HOST_PAGE_SIZE // 1024} KB memory pages."
+ return ""
+
+
def _service_starting(service) -> bool:
"""Startup requires declared container health, not a slow/failed HTTP probe."""
return (service is not None and service.status in {"down", "degraded"}
@@ -522,7 +551,7 @@ def _compute_extension_status(ext: dict, services_by_id: dict) -> str:
# A Library built-in this host's backend cannot run (ComfyUI needs AMD or
# NVIDIA) stays incompatible even though other hosts may add it; its
# selection and any receipt from a refused attempt are moot here.
- if ext_id in LIBRARY_MANAGEABLE_BUILTINS and not _gpu_compatible(ext):
+ if ext_id in LIBRARY_MANAGEABLE_BUILTINS and (not _gpu_compatible(ext) or _host_unsupported_reason(ext)):
return "incompatible"
# Check for in-flight install operations (progress files take priority)
@@ -605,8 +634,8 @@ def _compute_extension_status(ext: dict, services_by_id: dict) -> str:
if (user_dir / "compose.yaml.disabled").exists():
return "disabled"
- # GPU incompatibility
- if not _gpu_compatible(ext):
+ # GPU incompatibility, or an image this host cannot run
+ if not _gpu_compatible(ext) or _host_unsupported_reason(ext):
return "incompatible"
if ext.get("catalog_source") == "builtin":
@@ -2080,6 +2109,9 @@ async def extensions_catalog(
}
if ext_id == "opencode" and ext_id in SERVICES:
enriched.update(_opencode_catalog_fields(status))
+ unsupported = _host_unsupported_reason(ext)
+ if unsupported:
+ enriched["incompatible_reason"] = unsupported
llm_contract = _llm_contract_for_extension(ext)
if llm_contract is not None:
enriched["llm"] = llm_contract
@@ -3553,6 +3585,7 @@ async def extension_detail(
"description": ext.get("description", ""),
"status": status,
"error_message": error_message,
+ "incompatible_reason": _host_unsupported_reason(ext) or None,
"runtime_starting": status == "installing" and _service_starting(services_by_id.get(service_id)),
"source": source,
"installable": installable,
@@ -4813,6 +4846,9 @@ def prepare_extension_images(
status_code=409,
detail=f"{entry.get('name', service_id)} is not available on this hardware.",
)
+ unsupported = _host_unsupported_reason(entry)
+ if unsupported:
+ raise HTTPException(status_code=409, detail=unsupported)
bundled = EXTENSIONS_DIR.resolve()
if not _resolve_extension_dir(service_id).is_relative_to(bundled):
raise HTTPException(status_code=400, detail="Only services shipped with ODS prepare images ahead of enabling")
@@ -4862,6 +4898,9 @@ def enable_extension(
detail=f"{entry.get('name', service_id)} needs one of these GPU backends: {backends}. "
"It is not available on this hardware.",
)
+ unsupported = _host_unsupported_reason(entry)
+ if unsupported:
+ raise HTTPException(status_code=409, detail=unsupported)
ext_dir = _resolve_extension_dir(service_id)
diff --git a/ods/extensions/services/dashboard-api/tests/test_extension_image_prepare.py b/ods/extensions/services/dashboard-api/tests/test_extension_image_prepare.py
index 02d10f4b6..6e253efc4 100644
--- a/ods/extensions/services/dashboard-api/tests/test_extension_image_prepare.py
+++ b/ods/extensions/services/dashboard-api/tests/test_extension_image_prepare.py
@@ -98,3 +98,15 @@ def test_prepare_refuses_a_service_this_hardware_cannot_run(test_client, install
response = _prepare(test_client, "hermes")
assert response.status_code == 409 and "not available on this hardware" in response.json()["detail"]
agent.assert_not_called()
+
+
+def test_prepare_refuses_an_image_this_host_cannot_run(test_client, installation, agent, monkeypatch): # noqa: F811
+ """Workstation06 (2026-10-27): Qdrant's arm64 image aborts on 64 KB pages."""
+ monkeypatch.setattr(extensions, "EXTENSION_CATALOG", [{"id": "hermes", "name": "Hermes Agent",
+ "gpu_backends": ["all"],
+ "host_requirements": {"max_page_size": 4096}}])
+ monkeypatch.setattr(extensions, "_HOST_PAGE_SIZE", 65536)
+ response = _prepare(test_client, "hermes")
+ assert response.status_code == 409
+ assert response.json()["detail"] == "Hermes Agent's image cannot run with this machine's 64 KB memory pages."
+ agent.assert_not_called()
diff --git a/ods/extensions/services/dashboard-api/tests/test_extensions.py b/ods/extensions/services/dashboard-api/tests/test_extensions.py
index ed8fbe6ef..e595aceda 100644
--- a/ods/extensions/services/dashboard-api/tests/test_extensions.py
+++ b/ods/extensions/services/dashboard-api/tests/test_extensions.py
@@ -368,6 +368,57 @@ class TestExtensionsCatalog:
assert by_id["aider"]["installable"] is True
assert by_id["gpu-only"]["status"] == "incompatible"
+ @pytest.mark.parametrize("requirements,arch,page,backend,reason", [
+ ({"max_page_size": 4096}, "arm64", 65536, "nvidia",
+ "Vector DB's image cannot run with this machine's 64 KB memory pages."),
+ ({"architectures": ["amd64"]}, "arm64", 4096, "nvidia",
+ "Vector DB's image is built for amd64 only; this machine is arm64."),
+ ({"max_page_size": 4096}, "arm64", 4096, "nvidia", None),
+ ({"architectures": ["amd64"]}, "amd64", 4096, "nvidia", None),
+ # Docker Desktop on macOS runs amd64 images under Rosetta 2.
+ ({"architectures": ["amd64"]}, "arm64", 4096, "apple", None),
+ ])
+ def test_an_image_this_host_cannot_run_is_incompatible(
+ self, test_client, monkeypatch, tmp_path, requirements, arch, page, backend, reason,
+ ):
+ """Workstation06 (arm64, 64 KB pages, 2026-10-27): Qdrant aborted on its
+ page size and Fooocus has no arm64 image, yet both were offered."""
+ from routers import extensions as ext_mod
+
+ entry = {**_make_catalog_ext("vector-db", "Vector DB", gpu_backends=["all"]),
+ "host_requirements": requirements}
+ _patch_extensions_config(monkeypatch, [entry], gpu_backend=backend, tmp_path=tmp_path)
+ monkeypatch.setattr(ext_mod, "_HOST_ARCH", arch)
+ monkeypatch.setattr(ext_mod, "_HOST_PAGE_SIZE", page)
+
+ with patch("helpers.get_all_services", new_callable=AsyncMock, return_value=[]):
+ row = test_client.get("/api/extensions/catalog", headers=test_client.auth_headers).json()["extensions"][0]
+ detail = test_client.get("/api/extensions/vector-db", headers=test_client.auth_headers).json()
+
+ assert (row["status"] == "incompatible") is (reason is not None)
+ assert row.get("incompatible_reason") == reason
+ assert detail["incompatible_reason"] == reason
+
+ def test_enable_refuses_an_image_this_host_cannot_run(self, test_client, monkeypatch, tmp_path):
+ from routers import extensions as ext_mod
+
+ builtin_root = tmp_path / "builtin"
+ (builtin_root / "fooocus").mkdir(parents=True)
+ (builtin_root / "fooocus" / "compose.yaml.disabled").write_text(_SAFE_COMPOSE)
+ _patch_mutation_config(monkeypatch, tmp_path)
+ monkeypatch.setattr(ext_mod, "EXTENSIONS_DIR", builtin_root)
+ monkeypatch.setattr(ext_mod, "EXTENSION_CATALOG", [{
+ "id": "fooocus", "name": "Fooocus", "gpu_backends": ["nvidia"],
+ "host_requirements": {"architectures": ["amd64"]},
+ }])
+ monkeypatch.setattr(ext_mod, "_HOST_ARCH", "arm64")
+
+ resp = test_client.post("/api/extensions/fooocus/enable", headers=test_client.auth_headers)
+
+ assert resp.status_code == 409
+ assert resp.json()["detail"] == "Fooocus's image is built for amd64 only; this machine is arm64."
+ assert (builtin_root / "fooocus" / "compose.yaml.disabled").exists()
+
def test_catalog_summary_counts(self, test_client, monkeypatch, tmp_path):
"""Summary counts correctly reflect extension statuses."""
catalog = [
diff --git a/ods/extensions/services/fooocus/manifest.yaml b/ods/extensions/services/fooocus/manifest.yaml
index 7e58f1776..44a611f74 100644
--- a/ods/extensions/services/fooocus/manifest.yaml
+++ b/ods/extensions/services/fooocus/manifest.yaml
@@ -16,6 +16,10 @@ service:
startup_timeout: 600
type: docker
gpu_backends: [nvidia]
+ # Upstream publishes this image for amd64 only, and Linux has no amd64
+ # emulation by default ("exec format error" on arm64).
+ host_requirements:
+ architectures: [amd64]
compose_file: compose.yaml
category: optional
depends_on: []
diff --git a/ods/extensions/services/qdrant/manifest.yaml b/ods/extensions/services/qdrant/manifest.yaml
index 6ea731368..a657d4477 100644
--- a/ods/extensions/services/qdrant/manifest.yaml
+++ b/ods/extensions/services/qdrant/manifest.yaml
@@ -17,6 +17,10 @@ service:
ui_path: /dashboard
type: docker
gpu_backends: [all]
+ # The pinned arm64 image's jemalloc aborts on 16 KB and 64 KB kernel pages
+ # ("Unsupported system page size", DGX Station, #8257).
+ host_requirements:
+ max_page_size: 4096
compose_file: compose.yaml
category: optional
depends_on: []
diff --git a/ods/scripts/generate-extensions-catalog.py b/ods/scripts/generate-extensions-catalog.py
index d95f01fca..3f6c32c2f 100644
--- a/ods/scripts/generate-extensions-catalog.py
+++ b/ods/scripts/generate-extensions-catalog.py
@@ -117,6 +117,9 @@ def extract_entry(manifest: dict) -> dict | None:
"features": manifest.get("features") or service.get("features", []),
}
+ if isinstance(service.get("host_requirements"), dict):
+ entry["host_requirements"] = service["host_requirements"]
+
# The Library link needs the manifest's non-root entry point. Without it,
# an auth-gated service such as Hermes opens its native sign-in page.
if service.get("ui_path") not in (None, "/"):
diff --git a/ods/scripts/resolve-compose-stack.sh b/ods/scripts/resolve-compose-stack.sh
index 1a34ea70a..c9e9d5400 100755
--- a/ods/scripts/resolve-compose-stack.sh
+++ b/ods/scripts/resolve-compose-stack.sh
@@ -178,12 +178,36 @@ enable_open_webui = os.environ.get("ENABLE_OPEN_WEBUI", "true").lower() == "true
IS_DARWIN = platform.system() == "Darwin"
APPLE_OVERLAY = "installers/macos/docker-compose.macos.yml" if IS_DARWIN else "docker-compose.apple.yml"
+# HOST_ARCH is the installer's detect_host_arch value (amd64/arm64) and
+# HOST_PAGE_SIZE its getconf PAGE_SIZE; each falls back to this machine's.
+_host_arch = (os.environ.get("HOST_ARCH") or platform.machine()).strip().lower()
+HOST_ARCH = {"x86_64": "amd64", "aarch64": "arm64"}.get(_host_arch, _host_arch)
+_host_page_size = os.environ.get("HOST_PAGE_SIZE", "").strip()
+HOST_PAGE_SIZE = int(_host_page_size) if _host_page_size.isdecimal() else (
+ os.sysconf("SC_PAGE_SIZE") if hasattr(os, "sysconf") else 4096)
# Docker runs images natively except on macOS, where Docker Desktop runs amd64
# images under Rosetta 2. A bundled service whose upstream publishes no arm64
# image under its pinned tag ships an arm64 pin in compose.arm64.yaml (TEI).
-# HOST_ARCH is the installer's detect_host_arch value (amd64/arm64).
-ARM64_HOST = not IS_DARWIN and (
- os.environ.get("HOST_ARCH") or platform.machine()).strip().lower() in {"arm64", "aarch64"}
+ARM64_HOST = not IS_DARWIN and HOST_ARCH == "arm64"
+
+
+def _host_runs(service):
+ """Whether this host can run a bundled service's image (host_requirements).
+
+ The Dashboard marks a service it cannot run incompatible and hides it.
+ Leaving it out of the stack as well means one selected before that, such
+ as Qdrant on 64 KB pages or Fooocus on arm64 (Workstation06, 2026-10-27),
+ cannot keep crash-looping with no card left to disable it. Docker Desktop
+ on macOS runs a 4 KB-page VM with Rosetta 2, so nothing applies there.
+ """
+ requirements = service.get("host_requirements")
+ if IS_DARWIN or not isinstance(requirements, dict):
+ return True
+ architectures = requirements.get("architectures")
+ if isinstance(architectures, list) and HOST_ARCH not in architectures:
+ return False
+ max_page_size = requirements.get("max_page_size")
+ return not (type(max_page_size) is int and HOST_PAGE_SIZE > max_page_size)
macos_cloud_auth = script_dir / "data" / "generated" / "docker-compose.macos-cloud-auth.yml"
def existing(overlays):
@@ -1379,6 +1403,8 @@ if selected_stack is None and ext_dir.exists():
# "none" means CPU-only — compatible with any GPU backend
if gpu_backend not in backends and "all" not in backends and "none" not in backends:
continue
+ if not _host_runs(service):
+ continue
compose_rel = service.get("compose_file")
if compose_rel:
compose_path = _extension_base_path(service_dir, service, service_dir.name, assume_enabled)
diff --git a/ods/tests/ci-suite.txt b/ods/tests/ci-suite.txt
index 009025ddc..9b5398440 100644
--- a/ods/tests/ci-suite.txt
+++ b/ods/tests/ci-suite.txt
@@ -214,6 +214,7 @@ tests/test-resolve-compose-nondict-service.sh
tests/test-resolve-compose-symlinked-install.sh
tests/test-resolver-assume-enabled.py
tests/test-resolver-arm64-overlay.py
+tests/test-resolver-host-requirements.py
tests/test-restore-data-transaction-contract.sh
tests/test-restore-empty-config.sh
tests/test-restore-safety-ux.sh
diff --git a/ods/tests/test-resolver-host-requirements.py b/ods/tests/test-resolver-host-requirements.py
new file mode 100644
index 000000000..0b3f2ef27
--- /dev/null
+++ b/ods/tests/test-resolver-host-requirements.py
@@ -0,0 +1,62 @@
+"""A bundled service whose image this host cannot run stays out of the stack.
+
+The Dashboard marks it incompatible and hides it (manifest host_requirements,
+#8257). Leaving it out of Compose as well means a service selected before that,
+such as Qdrant on 64 KB pages or Fooocus on arm64 (Workstation06, 2026-10-27),
+cannot keep crash-looping with no card left to disable it.
+"""
+
+import os
+import platform
+from pathlib import Path
+import subprocess
+
+import pytest
+
+ROOT = Path(__file__).resolve().parents[1]
+RESOLVER = ROOT / "scripts" / "resolve-compose-stack.sh"
+BASE = "extensions/services/demo/compose.yaml"
+
+
+def install(tmp_path, requirements):
+ (tmp_path / "docker-compose.base.yml").write_text(
+ "services:\n dashboard-api:\n image: example/dashboard-api:1\n", encoding="utf-8")
+ bundled = tmp_path / "extensions" / "services" / "demo"
+ bundled.mkdir(parents=True)
+ (bundled / "manifest.yaml").write_text(
+ "schema_version: ods.services.v1\nservice:\n id: demo\n compose_file: compose.yaml\n"
+ f" gpu_backends: [all]\n host_requirements:\n {requirements}\n", encoding="utf-8")
+ (bundled / "compose.yaml").write_text(
+ "services:\n demo:\n image: example/demo:1\n", encoding="utf-8")
+ return tmp_path
+
+
+def resolve(root, host_arch, page_size):
+ env = {**os.environ, "ODS_MODE": "local", "HOST_ARCH": host_arch, "HOST_PAGE_SIZE": page_size}
+ for selector in ("ODS_RESOLVE_ASSUME_ENABLED", "ODS_SKIP_GPU_OVERLAYS", "ENABLE_OPEN_WEBUI"):
+ env.pop(selector, None)
+ result = subprocess.run(
+ ["bash", str(RESOLVER), "--script-dir", str(root), "--tier", "1", "--gpu-backend", "cpu",
+ "--gpu-count", "1", "--ods-mode", "local"],
+ capture_output=True, text=True, env=env, timeout=60,
+ )
+ assert result.returncode == 0, result.stderr
+ return [flag.replace("\\", "/") for flag in result.stdout.split()]
+
+
[email protected](platform.system() == "Darwin",
+ reason="Docker Desktop on macOS runs a 4 KB-page VM with Rosetta 2")
[email protected]("requirements,host_arch,page_size,included", [
+ ("max_page_size: 4096", "arm64", "65536", False),
+ ("max_page_size: 4096", "aarch64", "16384", False),
+ ("max_page_size: 4096", "arm64", "4096", True),
+ ("architectures: [amd64]", "arm64", "4096", False),
+ ("architectures: [amd64]", "aarch64", "4096", False),
+ ("architectures: [amd64]", "amd64", "4096", True),
+ ("architectures: [amd64]", "x86_64", "4096", True),
+ # A malformed override is ignored rather than crashing every ods command.
+ ("max_page_size: 4096", "amd64", "lots", True),
+])
+def test_a_service_runs_only_where_its_image_can(tmp_path, requirements, host_arch, page_size, included):
+ flags = resolve(install(tmp_path, requirements), host_arch, page_size)
+ assert (BASE in flags) is included