mirror of
https://github.com/containers/podman-compose.git
synced 2025-06-20 11:47:50 +02:00
tests/integration: Add reset tag attribute test
Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
parent
35dc395483
commit
5ab734026c
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,5 @@
|
||||
version: "3"
|
||||
services:
|
||||
app:
|
||||
image: busybox
|
||||
command: !reset {}
|
@ -0,0 +1,5 @@
|
||||
version: "3"
|
||||
services:
|
||||
app:
|
||||
image: busybox
|
||||
command: ["/bin/busybox", "echo", "Zero"]
|
@ -0,0 +1,58 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
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
|
||||
|
||||
|
||||
def compose_yaml_path():
|
||||
return os.path.join(os.path.join(test_path(), "reset_tag_attribute"), "docker-compose.yaml")
|
||||
|
||||
|
||||
class TestComposeResetTagAttribute(unittest.TestCase, RunSubprocessMixin):
|
||||
# test if the attribute of the service is correctly reset
|
||||
def test_reset_tag_attribute(self):
|
||||
reset_file = os.path.join(
|
||||
os.path.join(test_path(), "reset_tag_attribute"), "docker-compose.reset_attribute.yaml"
|
||||
)
|
||||
try:
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"-f",
|
||||
reset_file,
|
||||
"up",
|
||||
])
|
||||
|
||||
# the service still exists, but its command attribute was reset in
|
||||
# docker-compose.reset_tag_attribute.yaml file and is now empty
|
||||
output, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"-f",
|
||||
reset_file,
|
||||
"ps",
|
||||
])
|
||||
self.assertIn(b"reset_tag_attribute_app_1", output)
|
||||
|
||||
output, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"-f",
|
||||
reset_file,
|
||||
"logs",
|
||||
])
|
||||
self.assertEqual(output, b"")
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path(),
|
||||
"down",
|
||||
])
|
Loading…
x
Reference in New Issue
Block a user