mirror of
https://github.com/containers/podman-compose.git
synced 2025-05-31 23:45:51 +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 os
|
||||||
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
@ -85,15 +86,14 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
"container1",
|
"container1",
|
||||||
])
|
])
|
||||||
|
|
||||||
for _ in range(0, 3):
|
self.run_subprocess_assert_returncode([
|
||||||
self.run_subprocess_assert_returncode([
|
podman_compose_path(),
|
||||||
podman_compose_path(),
|
"-f",
|
||||||
"-f",
|
compose_path,
|
||||||
compose_path,
|
"up",
|
||||||
"up",
|
"-d",
|
||||||
"-d",
|
"container2",
|
||||||
"container2",
|
])
|
||||||
])
|
|
||||||
|
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
@ -105,6 +105,7 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
|
|
||||||
self.assertEqual(out, b"test1\n")
|
self.assertEqual(out, b"test1\n")
|
||||||
|
|
||||||
|
# "restart: always" keeps restarting container until its removal
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
@ -113,13 +114,22 @@ class TestLifetime(unittest.TestCase, RunSubprocessMixin):
|
|||||||
"container2",
|
"container2",
|
||||||
])
|
])
|
||||||
|
|
||||||
# BUG: container should be started 3 times, not 4.
|
if not out.startswith(b"test2\ntest2"):
|
||||||
self.assertEqual(out, b"test2\n" * 4)
|
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:
|
finally:
|
||||||
out, _ = self.run_subprocess_assert_returncode([
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
compose_path,
|
compose_path,
|
||||||
"down",
|
"down",
|
||||||
|
"-t",
|
||||||
|
"0",
|
||||||
])
|
])
|
||||||
|
@ -5,5 +5,5 @@ services:
|
|||||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||||
container2:
|
container2:
|
||||||
image: nopush/podman-compose-test
|
image: nopush/podman-compose-test
|
||||||
restart: never
|
restart: always
|
||||||
command: ["/bin/bash", "-c", "echo test2"]
|
command: ["/bin/bash", "-c", "echo test2"]
|
||||||
|
@ -6,6 +6,6 @@ services:
|
|||||||
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
command: ["/bin/bash", "-c", "echo test1; sleep infinity"]
|
||||||
container2:
|
container2:
|
||||||
image: nopush/podman-compose-test
|
image: nopush/podman-compose-test
|
||||||
restart: never
|
restart: always
|
||||||
ports: "9002:9002"
|
ports: "9002:9002"
|
||||||
command: ["/bin/bash", "-c", "echo test2"]
|
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
|
tty: true
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
replicas: 2
|
replicas: 3
|
||||||
|
@ -33,6 +33,15 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
|||||||
])
|
])
|
||||||
self.assertEqual(len(output.splitlines()), 2)
|
self.assertEqual(len(output.splitlines()), 2)
|
||||||
finally:
|
finally:
|
||||||
|
self.run_subprocess_assert_returncode([
|
||||||
|
"podman",
|
||||||
|
"rm",
|
||||||
|
"--force",
|
||||||
|
"-t",
|
||||||
|
"0",
|
||||||
|
"podman-compose_service1_1",
|
||||||
|
"podman-compose_service1_2",
|
||||||
|
])
|
||||||
self.run_subprocess_assert_returncode([
|
self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
@ -56,12 +65,22 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
|||||||
output, _, return_code = self.run_subprocess([
|
output, _, return_code = self.run_subprocess([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
compose_yaml_path("scaleup_scale_parameter"),
|
compose_yaml_path("scaleup_deploy_replicas_parameter"),
|
||||||
"ps",
|
"ps",
|
||||||
"-q",
|
"-q",
|
||||||
])
|
])
|
||||||
self.assertEqual(len(output.splitlines()), 2)
|
self.assertEqual(len(output.splitlines()), 3)
|
||||||
finally:
|
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([
|
self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
@ -89,18 +108,34 @@ class TestComposeScale(unittest.TestCase, RunSubprocessMixin):
|
|||||||
"up",
|
"up",
|
||||||
"-d",
|
"-d",
|
||||||
"--scale",
|
"--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([
|
output, _, return_code = self.run_subprocess([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-f",
|
||||||
compose_yaml_path("scaleup_scale_parameter"),
|
compose_yaml_path('scaleup_cli'),
|
||||||
"ps",
|
"ps",
|
||||||
"-q",
|
"-q",
|
||||||
])
|
])
|
||||||
self.assertEqual(len(output.splitlines()), 2)
|
self.assertEqual(len(output.splitlines()), 4)
|
||||||
finally:
|
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([
|
self.run_subprocess_assert_returncode([
|
||||||
podman_compose_path(),
|
podman_compose_path(),
|
||||||
"-f",
|
"-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