Skip to content

Commit 09db090

Browse files
committed
added integration test using docker.sock mount
1 parent 9cd6cfd commit 09db090

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```
2+
podman-compose up
3+
```
4+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: "3"
2+
services:
3+
web:
4+
image: nopush/podman-compose-test
5+
command: ["dumb-init", "/bin/busybox", "httpd", "-f", "-h", "/var/www/html", "-p", "8000"]
6+
working_dir: /var/www/html
7+
restart: always
8+
volumes:
9+
- /var/www/html
10+
- /var/run/docker.sock:/var/run/docker.sock
11+
tmpfs:
12+
- /run
13+
- /tmp
14+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
3+
"""
4+
test_podman_compose_up_down.py
5+
6+
Tests the podman compose up and down commands used to create and remove services.
7+
"""
8+
9+
# pylint: disable=redefined-outer-name
10+
import os
11+
import unittest
12+
13+
from tests.integration.test_utils import RunSubprocessMixin
14+
from tests.integration.test_utils import podman_compose_path
15+
from tests.integration.test_utils import test_path
16+
17+
18+
class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
19+
def test_with_docker_sock(self) -> None:
20+
up_cmd = [
21+
"coverage",
22+
"run",
23+
podman_compose_path(),
24+
"-f",
25+
os.path.join(test_path(), "docker_sock", "docker-compose.yaml"),
26+
"up",
27+
"-d",
28+
]
29+
30+
down_cmd = [
31+
"coverage",
32+
"run",
33+
podman_compose_path(),
34+
"-f",
35+
os.path.join(test_path(), "docker_sock", "docker-compose.yaml"),
36+
"down",
37+
"--volumes",
38+
]
39+
40+
try:
41+
self.run_subprocess_assert_returncode(up_cmd)
42+
43+
finally:
44+
out, _, return_code = self.run_subprocess(down_cmd)
45+
self.assertEqual(return_code, 0)

0 commit comments

Comments
 (0)