Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async def assert_volume(compose: PodmanCompose, mount_dict: dict[str, Any]) -> N
if mount_dict["type"] == "bind":
basedir = os.path.realpath(compose.dirname)
mount_src = mount_dict["source"]
mount_src = os.path.realpath(os.path.join(basedir, os.path.expanduser(mount_src)))
mount_src = os.path.abspath(os.path.join(basedir, os.path.expanduser(mount_src)))
if not os.path.exists(mount_src):
bind_opts = mount_dict.get("bind", {})
if "create_host_path" in bind_opts and not bind_opts["create_host_path"]:
Expand Down
4 changes: 4 additions & 0 deletions tests/integration/docker_sock/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```
podman-compose up
```

1 change: 1 addition & 0 deletions tests/integration/docker_sock/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

14 changes: 14 additions & 0 deletions tests/integration/docker_sock/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: "3"
services:
web:
image: nopush/podman-compose-test
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", "/var/www/html", "-p", "8000"]
working_dir: /var/www/html
restart: always
volumes:
- /var/www/html
- /var/run/docker.sock:/var/run/docker.sock
tmpfs:
- /run
- /tmp

45 changes: 45 additions & 0 deletions tests/integration/docker_sock/test_podman_compose_docker_sock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-2.0

"""
test_podman_compose_up_down.py

Tests the podman compose up and down commands used to create and remove services.
"""

# pylint: disable=redefined-outer-name
import os
import unittest

from tests.integration.test_utils import RunSubprocessMixin
from tests.integration.test_utils import podman_compose_path
from tests.integration.test_utils import test_path


class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
def test_with_docker_sock(self) -> None:
up_cmd = [
"coverage",
"run",
podman_compose_path(),
"-f",
os.path.join(test_path(), "docker_sock", "docker-compose.yaml"),
"up",
"-d",
]

down_cmd = [
"coverage",
"run",
podman_compose_path(),
"-f",
os.path.join(test_path(), "docker_sock", "docker-compose.yaml"),
"down",
"--volumes",
]

try:
self.run_subprocess_assert_returncode(up_cmd)

finally:
out, _, return_code = self.run_subprocess(down_cmd)
self.assertEqual(return_code, 0)