mirror of
https://github.com/home-assistant/core.git
synced 2025-09-13 08:41:32 +02:00
Make disk_lifetime issue into a repair (#150140)
This commit is contained in:
@@ -103,6 +103,7 @@ ISSUE_KEYS_FOR_REPAIRS = {
|
||||
ISSUE_KEY_SYSTEM_DOCKER_CONFIG,
|
||||
ISSUE_KEY_ADDON_DETACHED_ADDON_MISSING,
|
||||
ISSUE_KEY_ADDON_DETACHED_ADDON_REMOVED,
|
||||
"issue_system_disk_lifetime",
|
||||
}
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@@ -115,6 +115,10 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"issue_system_disk_lifetime": {
|
||||
"title": "Disk lifetime exceeding 90%",
|
||||
"description": "The data disk has exceeded 90% of its expected lifespan. The disk may soon malfunction which can lead to data loss. You should replace it soon and migrate your data."
|
||||
},
|
||||
"unhealthy": {
|
||||
"title": "Unhealthy system - {reason}",
|
||||
"description": "System is currently unhealthy due to {reason}. For troubleshooting information, select Learn more."
|
||||
|
@@ -850,3 +850,50 @@ async def test_supervisor_issues_detached_addon_missing(
|
||||
"addon_url": "/hassio/addon/test",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("all_setup_requests")
|
||||
async def test_supervisor_issues_disk_lifetime(
|
||||
hass: HomeAssistant,
|
||||
supervisor_client: AsyncMock,
|
||||
hass_ws_client: WebSocketGenerator,
|
||||
) -> None:
|
||||
"""Test supervisor issue for disk lifetime nearly exceeded."""
|
||||
mock_resolution_info(supervisor_client)
|
||||
|
||||
result = await async_setup_component(hass, "hassio", {})
|
||||
assert result
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
await client.send_json(
|
||||
{
|
||||
"id": 1,
|
||||
"type": "supervisor/event",
|
||||
"data": {
|
||||
"event": "issue_changed",
|
||||
"data": {
|
||||
"uuid": (issue_uuid := uuid4().hex),
|
||||
"type": "disk_lifetime",
|
||||
"context": "system",
|
||||
"reference": None,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
msg = await client.receive_json()
|
||||
assert msg["success"]
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await client.send_json({"id": 2, "type": "repairs/list_issues"})
|
||||
msg = await client.receive_json()
|
||||
assert msg["success"]
|
||||
assert len(msg["result"]["issues"]) == 1
|
||||
assert_issue_repair_in_list(
|
||||
msg["result"]["issues"],
|
||||
uuid=issue_uuid,
|
||||
context="system",
|
||||
type_="disk_lifetime",
|
||||
fixable=False,
|
||||
placeholders=None,
|
||||
)
|
||||
|
Reference in New Issue
Block a user