-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker-compose uses the path to the compose file even if it's symlink to get the context directory. Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
- Loading branch information
Showing
7 changed files
with
58 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix compatibility with docker-compose in how symlinks to docker-compose.yml are handled. |
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
1 change: 1 addition & 0 deletions
1
tests/integration/filesystem/compose_symlink/docker-compose.yml
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 @@ | ||
../compose_symlink_dest/docker-compose.yml |
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 @@ | ||
data_compose_symlink |
7 changes: 7 additions & 0 deletions
7
tests/integration/filesystem/compose_symlink_dest/docker-compose.yml
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,7 @@ | ||
version: "3" | ||
services: | ||
container1: | ||
image: nopush/podman-compose-test | ||
command: ["/bin/busybox", "cat", "/file"] | ||
volumes: | ||
- "./file:/file" |
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 @@ | ||
data_compose_symlink_dest |
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,47 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
|
||
|
||
import os | ||
import unittest | ||
|
||
from tests.integration.test_podman_compose import podman_compose_path | ||
from tests.integration.test_podman_compose import test_path | ||
from tests.integration.test_utils import RunSubprocessMixin | ||
|
||
|
||
class TestFilesystem(unittest.TestCase, RunSubprocessMixin): | ||
def test_compose_symlink(self): | ||
"""The context of podman-compose.yml should come from the same directory as the file even | ||
if it is a symlink | ||
""" | ||
|
||
compose_path = os.path.join(test_path(), "filesystem/compose_symlink/docker-compose.yml") | ||
|
||
try: | ||
self.run_subprocess_assert_returncode([ | ||
podman_compose_path(), | ||
"-f", | ||
compose_path, | ||
"up", | ||
"-d", | ||
"container1", | ||
]) | ||
|
||
out, _ = self.run_subprocess_assert_returncode([ | ||
podman_compose_path(), | ||
"-f", | ||
compose_path, | ||
"logs", | ||
"container1", | ||
]) | ||
|
||
# BUG: figure out why cat is called twice | ||
self.assertEqual(out, b'data_compose_symlink\ndata_compose_symlink\n') | ||
|
||
finally: | ||
out, _ = self.run_subprocess_assert_returncode([ | ||
podman_compose_path(), | ||
"-f", | ||
compose_path, | ||
"down", | ||
]) |