1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 20:35:55 +00:00

Exclude already-existing layers from pull progress calculation

Layers that already exist locally should not count towards download
progress since there's nothing to download for them. Only layers that
need pulling are included in the progress calculation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2025-12-01 18:24:35 +01:00
parent e7c8700db9
commit 87e1e7a3ab
5 changed files with 39 additions and 35 deletions

View File

@@ -764,8 +764,8 @@ async def test_api_progress_updates_addon_install_update(
and evt.args[0]["data"]["data"]["name"] == job_name
and evt.args[0]["data"]["data"]["reference"] == addon_slug
]
# Count-based progress: 4 layers (2 cached = 50%, 2 pulling = 25% each)
# Cached layers contribute immediately when downloading starts
# Count-based progress: 2 layers need pulling (each worth 50%)
# Layers that already exist are excluded from progress calculation
assert events[:4] == [
{
"stage": None,
@@ -774,34 +774,34 @@ async def test_api_progress_updates_addon_install_update(
},
{
"stage": None,
"progress": 50.0,
"progress": 9.2,
"done": False,
},
{
"stage": None,
"progress": 54.6,
"progress": 25.6,
"done": False,
},
{
"stage": None,
"progress": 62.8,
"progress": 35.4,
"done": False,
},
]
assert events[-5:] == [
{
"stage": None,
"progress": 95.7,
"progress": 95.5,
"done": False,
},
{
"stage": None,
"progress": 97.1,
"progress": 96.9,
"done": False,
},
{
"stage": None,
"progress": 98.4,
"progress": 98.2,
"done": False,
},
{