mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-07-10 07:13:49 +01:00
00c48a88ea
* 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
68 lines
2.3 KiB
Python
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
|