Add container arch to system info (#147372)

This commit is contained in:
Stefan Agner
2025-06-24 09:52:21 +02:00
committed by GitHub
parent 121239bcf7
commit e5d19baf3e
14 changed files with 99 additions and 118 deletions

View File

@@ -9,6 +9,7 @@
dev | False
hassio | False
docker | False
container_arch | None
user | hass
virtualenv | False
python_version | 3.13.1

View File

@@ -1931,6 +1931,7 @@ async def test_download_support_package(
"virtualenv": False,
"python_version": "3.13.1",
"docker": False,
"container_arch": None,
"arch": "x86_64",
"timezone": "US/Pacific",
"os_name": "Linux",

View File

@@ -260,16 +260,3 @@ def all_setup_requests(
},
},
)
@pytest.fixture
def arch() -> str:
"""Arch found in apk file."""
return "amd64"
@pytest.fixture(autouse=True)
def mock_arch_file(arch: str) -> Generator[None]:
"""Mock arch file."""
with patch("homeassistant.components.hassio._get_arch", return_value=arch):
yield

View File

@@ -1156,10 +1156,6 @@ def test_deprecated_constants(
("rpi2", "deprecated_os_armv7"),
],
)
@pytest.mark.parametrize(
"arch",
["armv7"],
)
async def test_deprecated_installation_issue_os_armv7(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
@@ -1170,13 +1166,6 @@ async def test_deprecated_installation_issue_os_armv7(
"""Test deprecated installation issue."""
with (
patch.dict(os.environ, MOCK_ENVIRON),
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant OS",
"arch": "armv7",
},
),
patch(
"homeassistant.components.hassio._is_32_bit",
return_value=True,
@@ -1185,7 +1174,8 @@ async def test_deprecated_installation_issue_os_armv7(
"homeassistant.components.hassio.get_os_info", return_value={"board": board}
),
patch(
"homeassistant.components.hassio.get_info", return_value={"hassos": True}
"homeassistant.components.hassio.get_info",
return_value={"hassos": True, "arch": "armv7"},
),
patch("homeassistant.components.hardware.async_setup", return_value=True),
):
@@ -1238,13 +1228,6 @@ async def test_deprecated_installation_issue_32bit_os(
"""Test deprecated architecture issue."""
with (
patch.dict(os.environ, MOCK_ENVIRON),
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant OS",
"arch": arch,
},
),
patch(
"homeassistant.components.hassio._is_32_bit",
return_value=True,
@@ -1254,7 +1237,8 @@ async def test_deprecated_installation_issue_32bit_os(
return_value={"board": "rpi3-64"},
),
patch(
"homeassistant.components.hassio.get_info", return_value={"hassos": True}
"homeassistant.components.hassio.get_info",
return_value={"hassos": True, "arch": arch},
),
patch("homeassistant.components.hardware.async_setup", return_value=True),
):
@@ -1305,13 +1289,6 @@ async def test_deprecated_installation_issue_32bit_supervised(
"""Test deprecated architecture issue."""
with (
patch.dict(os.environ, MOCK_ENVIRON),
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant Supervised",
"arch": arch,
},
),
patch(
"homeassistant.components.hassio._is_32_bit",
return_value=True,
@@ -1321,7 +1298,8 @@ async def test_deprecated_installation_issue_32bit_supervised(
return_value={"board": "rpi3-64"},
),
patch(
"homeassistant.components.hassio.get_info", return_value={"hassos": None}
"homeassistant.components.hassio.get_info",
return_value={"hassos": None, "arch": arch},
),
patch("homeassistant.components.hardware.async_setup", return_value=True),
):
@@ -1376,13 +1354,6 @@ async def test_deprecated_installation_issue_64bit_supervised(
"""Test deprecated architecture issue."""
with (
patch.dict(os.environ, MOCK_ENVIRON),
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant Supervised",
"arch": arch,
},
),
patch(
"homeassistant.components.hassio._is_32_bit",
return_value=False,
@@ -1392,7 +1363,8 @@ async def test_deprecated_installation_issue_64bit_supervised(
return_value={"board": "generic-x86-64"},
),
patch(
"homeassistant.components.hassio.get_info", return_value={"hassos": None}
"homeassistant.components.hassio.get_info",
return_value={"hassos": None, "arch": arch},
),
patch("homeassistant.components.hardware.async_setup", return_value=True),
):
@@ -1445,13 +1417,6 @@ async def test_deprecated_installation_issue_supported_board(
"""Test no deprecated installation issue for a supported board."""
with (
patch.dict(os.environ, MOCK_ENVIRON),
patch(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant OS",
"arch": "aarch64",
},
),
patch(
"homeassistant.components.hassio._is_32_bit",
return_value=False,
@@ -1460,7 +1425,8 @@ async def test_deprecated_installation_issue_supported_board(
"homeassistant.components.hassio.get_os_info", return_value={"board": board}
),
patch(
"homeassistant.components.hassio.get_info", return_value={"hassos": True}
"homeassistant.components.hassio.get_info",
return_value={"hassos": True, "arch": "aarch64"},
),
):
assert await async_setup_component(hass, "homeassistant", {})

View File

@@ -24,6 +24,7 @@ from homeassistant.const import (
ENTITY_MATCH_ALL,
ENTITY_MATCH_NONE,
EVENT_CORE_CONFIG_UPDATE,
EVENT_HOMEASSISTANT_STARTED,
SERVICE_SAVE_PERSISTENT_STATES,
SERVICE_TOGGLE,
SERVICE_TURN_OFF,
@@ -668,6 +669,7 @@ async def test_deprecated_installation_issue_32bit_core(
),
):
assert await async_setup_component(hass, DOMAIN, {})
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
@@ -707,6 +709,7 @@ async def test_deprecated_installation_issue_64bit_core(
),
):
assert await async_setup_component(hass, DOMAIN, {})
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1
@@ -738,6 +741,7 @@ async def test_deprecated_installation_issue_32bit(
"homeassistant.components.homeassistant.async_get_system_info",
return_value={
"installation_type": "Home Assistant Container",
"container_arch": arch,
"arch": arch,
},
),
@@ -745,12 +749,9 @@ async def test_deprecated_installation_issue_32bit(
"homeassistant.components.homeassistant._is_32_bit",
return_value=True,
),
patch(
"homeassistant.components.homeassistant._get_arch",
return_value=arch,
),
):
assert await async_setup_component(hass, DOMAIN, {})
hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_block_till_done()
assert len(issue_registry.issues) == 1