-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Podman for mocking Lambda (#3702)
* Support Podman for mocking Lambda Podman supports all Docker APIs used in moto since version 3.0. Note that Podman requires pulling the image before creating a container using a fully-qualified image name (e.g., "docker.io/library/busybox" instead of "busybox"). Test plan: $ podman system service -t 0 $ DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock" pytest Fixes #3276 * Run black * Python 2 compatibility * Address review comments and improve parse_image_ref
- Loading branch information
Chih-Hsuan Yen
authored
Feb 18, 2021
1 parent
d3ad9d6
commit 2000f66
Showing
5 changed files
with
68 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import sure | ||
import pytest | ||
|
||
from moto.utilities.docker_utilities import parse_image_ref | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"image_name,expected", | ||
[ | ||
("python", ("docker.io/library/python", "latest")), | ||
("python:3.9", ("docker.io/library/python", "3.9")), | ||
("docker.io/python", ("docker.io/library/python", "latest")), | ||
("localhost/foobar", ("localhost/foobar", "latest")), | ||
("lambci/lambda:python2.7", ("docker.io/lambci/lambda", "python2.7")), | ||
( | ||
"gcr.io/google.com/cloudsdktool/cloud-sdk", | ||
("gcr.io/google.com/cloudsdktool/cloud-sdk", "latest"), | ||
), | ||
], | ||
) | ||
def test_parse_image_ref(image_name, expected): | ||
expected.should.be.equal(parse_image_ref(image_name)) | ||
|
||
|
||
def test_parse_image_ref_default_container_registry(monkeypatch): | ||
import moto.settings | ||
|
||
monkeypatch.setattr(moto.settings, "DEFAULT_CONTAINER_REGISTRY", "quay.io") | ||
("quay.io/centos/centos", "latest").should.be.equal( | ||
parse_image_ref("centos/centos") | ||
) |