1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2026-07-10 07:13:49 +01:00
Files
supervisor/tests/resolution/fixup/test_system_execute_rebuild.py
T
Mike Degatano 00c48a88ea Improve port conflict detection and resolution across Core and apps (#6916)
* Finalize port conflict handling and test coverage

* Fix port conflict regressions and align resolution tests

* Simplify port conflict detection: remove app options validation and manager helper

* Refactor approve_check and process_fixup to accept typed Issue/Suggestion objects

* Remove core port conflict detection; keep app startup handling

* Remove unused code

* Auto-dismiss issue on app start and remove more dead code
2026-06-23 16:26:56 +02:00

68 lines
2.3 KiB
Python

"""Test fixup system execute rebuild."""
from unittest.mock import patch
from supervisor.coresys import CoreSys
from supervisor.resolution.const import ContextType, IssueType, SuggestionType
from supervisor.resolution.data import Suggestion
from supervisor.resolution.fixups.app_execute_rebuild import FixupAppExecuteRebuild
from supervisor.resolution.fixups.core_execute_rebuild import FixupCoreExecuteRebuild
from supervisor.resolution.fixups.plugin_execute_rebuild import (
FixupPluginExecuteRebuild,
)
from supervisor.resolution.fixups.system_execute_rebuild import (
FixupSystemExecuteRebuild,
)
async def test_fixup(coresys: CoreSys):
"""Test fixup applies other rebuild fixups for docker config issues."""
system_execute_rebuild = FixupSystemExecuteRebuild(coresys)
assert system_execute_rebuild.auto is False
coresys.resolution.create_issue(
IssueType.DOCKER_CONFIG,
ContextType.ADDON,
reference="local_ssh",
suggestions=[SuggestionType.EXECUTE_REBUILD],
)
coresys.resolution.create_issue(
IssueType.DOCKER_CONFIG,
ContextType.CORE,
suggestions=[SuggestionType.EXECUTE_REBUILD],
)
coresys.resolution.create_issue(
IssueType.DOCKER_CONFIG,
ContextType.PLUGIN,
reference="audio",
suggestions=[SuggestionType.EXECUTE_REBUILD],
)
coresys.resolution.create_issue(
IssueType.DOCKER_CONFIG,
ContextType.SYSTEM,
suggestions=[SuggestionType.EXECUTE_REBUILD],
)
with (
patch.object(FixupAppExecuteRebuild, "process_fixup") as app_fixup,
patch.object(FixupCoreExecuteRebuild, "process_fixup") as core_fixup,
patch.object(FixupPluginExecuteRebuild, "process_fixup") as plugin_fixup,
):
await system_execute_rebuild()
app_fixup.assert_called_once_with(
Suggestion(
SuggestionType.EXECUTE_REBUILD, ContextType.ADDON, reference="local_ssh"
)
)
core_fixup.assert_called_once_with(
Suggestion(SuggestionType.EXECUTE_REBUILD, ContextType.CORE)
)
plugin_fixup.assert_called_once_with(
Suggestion(
SuggestionType.EXECUTE_REBUILD, ContextType.PLUGIN, reference="audio"
)
)
assert not coresys.resolution.issues
assert not coresys.resolution.suggestions