fix: Docker API compatible bool deserialization

In Docker anything but "", "0", "no", "false", "none" (ignoring case) is considered to be true.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek
2023-08-10 23:47:09 +02:00
parent 4cb2d48ca4
commit f33b01b731
27 changed files with 82 additions and 52 deletions

View File

@ -239,6 +239,26 @@ class TestContainers(common.DockerTestCase):
ret, _ = ctr.exec_run(["stat", "/workspace/scratch/test"])
self.assertEqual(ret, 0, "Working directory created if it doesn't exist")
def test_build_pull(self):
dockerfile = (
b"FROM quay.io/libpod/alpine:latest\n"
b"USER 1000:1000\n"
)
img: Image
img, logs = self.docker.images.build(fileobj=io.BytesIO(dockerfile), quiet=False, pull=True)
has_tried_pull = False
for e in logs:
if "stream" in e and "trying to pull" in e["stream"].lower():
has_tried_pull = True
self.assertTrue(has_tried_pull, "the build process has not tried to pull the base image")
img, logs = self.docker.images.build(fileobj=io.BytesIO(dockerfile), quiet=False, pull=False)
has_tried_pull = False
for e in logs:
if "stream" in e and "trying to pull" in e["stream"].lower():
has_tried_pull = True
self.assertFalse(has_tried_pull, "the build process has tried tried to pull the base image")
def test_mount_rw_by_default(self):
ctr: Optional[Container] = None
vol: Optional[Volume] = None