mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-19 20:55:14 +02:00
fix: stop reporting a missing image as a network problem
A 404 from the registry means the image name is wrong or the registry needs authentication, but the pull wrapped every error with "please check your Internet connection". Say what actually failed and keep the network advice for the other errors.
This commit is contained in:
2 files changed
+27
-2
No files matched your search
@@ -259,6 +259,24 @@ async def test_pull_image_error():
|
||||
response.close.assert_called_once()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pull_image_not_found_is_not_reported_as_a_network_error():
|
||||
"""
|
||||
A 404 from the registry means the image name is wrong or the registry needs
|
||||
authentication: telling the user to check the Internet connection sends
|
||||
them in the wrong direction.
|
||||
"""
|
||||
|
||||
with asyncio_patch("gns3server.compute.docker.Docker.query", side_effect=DockerHttp404Error("404")):
|
||||
with asyncio_patch(
|
||||
"gns3server.compute.docker.Docker.http_query",
|
||||
side_effect=DockerHttp404Error("Docker has returned an error: 404 pull access denied for debian13"),
|
||||
):
|
||||
with pytest.raises(DockerError, match="not found in the registry") as error:
|
||||
await Docker.instance().pull_image("debian13")
|
||||
assert "Internet connection" not in str(error.value)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_pull_image_rejects_incomplete_response():
|
||||
|
||||
|
||||
Reference in new issue
Block a user