Skip to content

Commit 55bd18d

Browse files
committed
chore: test for fallback on linux image
1 parent b29e110 commit 55bd18d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/unit/verticals/secret/test_scan_docker.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ def test_docker_pull_image_timeout(self):
148148
):
149149
docker_pull_image("ggshield-non-existant", DOCKER_TIMEOUT)
150150

151+
def test_docker_pull_image_platform_fallback(self):
152+
with patch(
153+
"subprocess.run", side_effect=subprocess.CalledProcessError(1, cmd=[])
154+
) as call, pytest.raises(
155+
click.UsageError,
156+
match='Image "ggshield-non-existant" not found',
157+
):
158+
docker_pull_image("ggshield-non-existant", DOCKER_TIMEOUT)
159+
call.assert_called_once_with(
160+
["docker", "pull", "ggshield-non-existant", "--platform=linux/amd64"],
161+
check=True,
162+
timeout=DOCKER_TIMEOUT,
163+
)
164+
151165

152166
class TestDockerSave:
153167
TMP_ARCHIVE = Path("/tmp/as/archive.tar")

0 commit comments

Comments
 (0)