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 https://github.com/spulec/moto/issues/3276 * Run black * Python 2 compatibility * Address review comments and improve parse_image_ref
This commit is contained in:
parent
d3ad9d6686
commit
2000f6654f
5 changed files with 68 additions and 3 deletions
31
tests/test_utilities/test_docker_utilities.py
Normal file
31
tests/test_utilities/test_docker_utilities.py
Normal file
|
|
@ -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")
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue