v0.2.2: BUILD_FAILED pull failure aborts redeploy with clear message
Remove contextlib.suppress from the image pull step in the BUILD_FAILED redeploy path. A failed pull (e.g. non-existent tag) now immediately returns an actionable error pointing to update_image_tag instead of silently continuing and starting the project with stale/missing image. Also bumps version 0.2.1 → 0.2.2 and adds CHANGELOG entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -286,13 +286,13 @@ async def test_redeploy_build_failed_project():
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_redeploy_build_failed_stop_error_nonfatal():
|
||||
"""BUILD_FAILED: stop/pull failures must not abort the redeploy."""
|
||||
"""BUILD_FAILED: stop failure is non-fatal and must not abort the redeploy."""
|
||||
from mcp_synology_container.dsm_client import SynologyError
|
||||
|
||||
client, _ = make_stateful_redeploy_mock(
|
||||
"BUILD_FAILED",
|
||||
stop_raises=SynologyError("already stopped", code=2101),
|
||||
pull_raises=SynologyError("pull failed", code=2102),
|
||||
pull_raises=None, # pull succeeds
|
||||
)
|
||||
tools = make_projects_tools(client)
|
||||
|
||||
@@ -302,6 +302,29 @@ async def test_redeploy_build_failed_stop_error_nonfatal():
|
||||
assert "redeployed successfully" in result
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_redeploy_build_failed_pull_error_aborts():
|
||||
"""BUILD_FAILED: pull failure must abort redeploy with a clear message."""
|
||||
from mcp_synology_container.dsm_client import SynologyError
|
||||
|
||||
client, calls = make_stateful_redeploy_mock(
|
||||
"BUILD_FAILED",
|
||||
stop_raises=None,
|
||||
pull_raises=SynologyError("image not found", code=114),
|
||||
)
|
||||
tools = make_projects_tools(client)
|
||||
|
||||
with patch("mcp_synology_container.modules.projects.asyncio.sleep"):
|
||||
result = await tools["redeploy_project"]("myapp", confirmed=True)
|
||||
|
||||
assert "redeployed successfully" not in result
|
||||
assert "Aborted" in result or "pull failed" in result.lower()
|
||||
assert "compose.yaml" in result or "update_image_tag" in result
|
||||
# start must NOT have been called after a pull failure
|
||||
methods = [m for _, m in calls]
|
||||
assert "start" not in methods
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_redeploy_poll_timeout():
|
||||
"""If project never reaches RUNNING after start, a warning is emitted."""
|
||||
|
||||
Reference in New Issue
Block a user