mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-30 15:08:49 +02:00
Merge pull request #1205 from mokibit/add-missing-init-py-files
tests/integration: Add missing __init__.py files to actually run tests and fix the broken ones
This commit is contained in:
commit
0dcc864fdd
0
tests/integration/lifetime/__init__.py
Normal file
0
tests/integration/lifetime/__init__.py
Normal file
@ -2,6 +2,7 @@
|
||||
|
||||
|
||||
import os
|
||||
import time
|
||||
import unittest
|
||||
|
||||
from parameterized import parameterized
|
||||
@ -85,15 +86,14 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
||||
"container1",
|
||||
])
|
||||
|
||||
for _ in range(0, 3):
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_path,
|
||||
"up",
|
||||
"-d",
|
||||
"container2",
|
||||
])
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_path,
|
||||
"up",
|
||||
"-d",
|
||||
"container2",
|
||||
])
|
||||
|
||||
out, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
@ -105,6 +105,7 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
||||
|
||||
self.assertEqual(out, b"test1\n")
|
||||
|
||||
# "restart: always" keeps restarting container until its removal
|
||||
out, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
@ -113,13 +114,22 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
||||
"container2",
|
||||
])
|
||||
|
||||
# BUG: container should be started 3 times, not 4.
|
||||
self.assertEqual(out, b"test2\n" * 4)
|
||||
|
||||
if not out.startswith(b"test2\ntest2"):
|
||||
time.sleep(1)
|
||||
out, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_path,
|
||||
"logs",
|
||||
"container2",
|
||||
])
|
||||
self.assertTrue(out.startswith(b"test2\ntest2"))
|
||||
finally:
|
||||
out, _ = self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_path,
|
||||
"down",
|
||||
"-t",
|
||||
"0",
|
||||
])
|
||||
|
@ -5,5 +5,5 @@ services:
|
||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||
container2:
|
||||
image: nopush/podman-compose-test
|
||||
restart: never
|
||||
restart: always
|
||||
command: ["/bin/bash", "-c", "echo test2"]
|
||||
|
@ -6,6 +6,6 @@ services:
|
||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||
container2:
|
||||
image: nopush/podman-compose-test
|
||||
restart: never
|
||||
restart: always
|
||||
ports: "9002:9002"
|
||||
command: ["/bin/bash", "-c", "echo test2"]
|
||||
|
0
tests/integration/nets_test3/__init__.py
Normal file
0
tests/integration/nets_test3/__init__.py
Normal file
0
tests/integration/nets_test_ip/__init__.py
Normal file
0
tests/integration/nets_test_ip/__init__.py
Normal file
0
tests/integration/no_services/__init__.py
Normal file
0
tests/integration/no_services/__init__.py
Normal file
0
tests/integration/seccomp/__init__.py
Normal file
0
tests/integration/seccomp/__init__.py
Normal file
0
tests/integration/secrets/__init__.py
Normal file
0
tests/integration/secrets/__init__.py
Normal file
0
tests/integration/selinux/__init__.py
Normal file
0
tests/integration/selinux/__init__.py
Normal file
0
tests/integration/service_scale/__init__.py
Normal file
0
tests/integration/service_scale/__init__.py
Normal file
@ -6,4 +6,4 @@ services:
|
||||
tty: true
|
||||
deploy:
|
||||
mode: replicated
|
||||
replicas: 2
|
||||
replicas: 3
|
||||
|
@ -33,6 +33,15 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
||||
])
|
||||
self.assertEqual(len(output.splitlines()), 2)
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
"podman",
|
||||
"rm",
|
||||
"--force",
|
||||
"-t",
|
||||
"0",
|
||||
"podman-compose_service1_1",
|
||||
"podman-compose_service1_2",
|
||||
])
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
@ -56,12 +65,22 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
||||
output, _, return_code = self.run_subprocess([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path("scaleup_scale_parameter"),
|
||||
compose_yaml_path("scaleup_deploy_replicas_parameter"),
|
||||
"ps",
|
||||
"-q",
|
||||
])
|
||||
self.assertEqual(len(output.splitlines()), 2)
|
||||
self.assertEqual(len(output.splitlines()), 3)
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
"podman",
|
||||
"rm",
|
||||
"--force",
|
||||
"-t",
|
||||
"0",
|
||||
"podman-compose_service1_1",
|
||||
"podman-compose_service1_2",
|
||||
"podman-compose_service1_3",
|
||||
])
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
@ -89,18 +108,34 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
||||
"up",
|
||||
"-d",
|
||||
"--scale",
|
||||
"service1=2",
|
||||
"service1=4",
|
||||
])
|
||||
self.assertEqual(return_code, 0)
|
||||
# error code 125 is expected as podman-compose complains about already used name
|
||||
# "podman-compose_service1_1" for the 1st container
|
||||
# Nevertheless, following containers are still created to scale as expected
|
||||
# (in test case till 3 containers)
|
||||
self.assertEqual(return_code, 125)
|
||||
|
||||
output, _, return_code = self.run_subprocess([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
compose_yaml_path("scaleup_scale_parameter"),
|
||||
compose_yaml_path('scaleup_cli'),
|
||||
"ps",
|
||||
"-q",
|
||||
])
|
||||
self.assertEqual(len(output.splitlines()), 2)
|
||||
self.assertEqual(len(output.splitlines()), 4)
|
||||
finally:
|
||||
self.run_subprocess_assert_returncode([
|
||||
"podman",
|
||||
"rm",
|
||||
"--force",
|
||||
"-t",
|
||||
"0",
|
||||
"podman-compose_service1_1",
|
||||
"podman-compose_service1_2",
|
||||
"podman-compose_service1_3",
|
||||
"podman-compose_service1_4",
|
||||
])
|
||||
self.run_subprocess_assert_returncode([
|
||||
podman_compose_path(),
|
||||
"-f",
|
||||
|
0
tests/integration/uidmaps/__init__.py
Normal file
0
tests/integration/uidmaps/__init__.py
Normal file
Loading…
x
Reference in New Issue
Block a user