2022-05-18 06:19:21 +02:00
|
|
|
import pytest
|
2022-05-18 17:28:18 +02:00
|
|
|
|
2022-05-07 18:42:14 +02:00
|
|
|
from compose_viz.compose import Compose
|
2022-05-18 10:03:33 +02:00
|
|
|
from compose_viz.extends import Extends
|
2022-05-18 17:28:18 +02:00
|
|
|
from compose_viz.parser import Parser
|
|
|
|
from compose_viz.service import Service
|
2022-05-21 11:41:26 +02:00
|
|
|
from compose_viz.volume import Volume, VolumeType
|
2022-05-07 18:42:14 +02:00
|
|
|
|
2022-05-18 17:28:18 +02:00
|
|
|
|
|
|
|
@pytest.mark.parametrize(
|
2022-05-18 17:33:56 +02:00
|
|
|
"test_input, expected",
|
2022-05-18 17:28:18 +02:00
|
|
|
[
|
|
|
|
(
|
|
|
|
"tests/in/000001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="base",
|
|
|
|
image="busybox",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="common",
|
2022-05-21 09:38:59 +02:00
|
|
|
extends=Extends(service_name="base"),
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="cli",
|
|
|
|
extends=Extends(service_name="common"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="web",
|
|
|
|
image="build from .",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="redis",
|
|
|
|
image="redis:alpine",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
ports=["8000:5001"],
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
ports=["8000:5010"],
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5001"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/000111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
ports=["8000:5001"],
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="web",
|
|
|
|
image="build from .",
|
|
|
|
depends_on=["db", "redis"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="redis",
|
|
|
|
image="redis",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
depends_on=["monitoring", "backend"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="web",
|
|
|
|
depends_on=["db", "redis"],
|
|
|
|
extends=Extends(service_name="redis"),
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="redis",
|
|
|
|
image="redis",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
depends_on=["monitoring", "backend"],
|
|
|
|
extends=Extends(service_name="backend"),
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
depends_on=["backend"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
ports=["8000:5001"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
depends_on=["backend"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
depends_on=["backend"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 10:33:04 +02:00
|
|
|
extends=Extends(service_name="frontend"),
|
2022-05-18 17:28:18 +02:00
|
|
|
ports=["8000:5001"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/001111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
depends_on=["backend"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="common",
|
|
|
|
image="busybox",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[Volume(source="common-volume", target="/var/lib/backup/data:rw")],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="cli",
|
|
|
|
extends=Extends(service_name="common"),
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[Volume(source="cli-volume", target="/var/lib/backup/data:ro")],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="monitoring"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="monitoring"),
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/010111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="monitoring"),
|
|
|
|
ports=["8000:5000"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
depends_on=["backend"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
2022-05-21 16:13:48 +02:00
|
|
|
ports=["8000:5000"],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
2022-05-21 16:13:48 +02:00
|
|
|
ports=["8000:5010"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-21 09:38:59 +02:00
|
|
|
depends_on=["backend"],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 09:38:59 +02:00
|
|
|
image="awesome/backend",
|
|
|
|
ports=["8000:5001"],
|
2022-05-18 17:28:18 +02:00
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/011111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="monitoring"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="web",
|
|
|
|
image="build from .",
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/100111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/101111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/110111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111000.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
depends_on=["backend"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111001.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111010.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111011.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111100.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111101.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
image="awesome/backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111110.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"tests/in/111111.yaml",
|
|
|
|
Compose(
|
|
|
|
[
|
|
|
|
Service(
|
|
|
|
name="frontend",
|
|
|
|
image="awesome/webapp",
|
|
|
|
networks=["front-tier", "back-tier"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="monitoring",
|
|
|
|
image="awesome/monitoring",
|
|
|
|
networks=["admin"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="backend",
|
|
|
|
networks=["back-tier", "admin"],
|
2022-05-21 11:41:26 +02:00
|
|
|
volumes=[
|
|
|
|
Volume(source="db-data", target="/data"),
|
|
|
|
Volume(
|
|
|
|
source="/var/run/postgres/postgres.sock",
|
|
|
|
target="/var/run/postgres/postgres.sock",
|
|
|
|
type=VolumeType.bind,
|
|
|
|
),
|
|
|
|
],
|
2022-05-18 17:28:18 +02:00
|
|
|
depends_on=["monitoring"],
|
|
|
|
extends=Extends(service_name="frontend"),
|
|
|
|
ports=["8000:5010"],
|
|
|
|
links=["db:database"],
|
|
|
|
),
|
|
|
|
Service(
|
|
|
|
name="db",
|
|
|
|
image="postgres",
|
|
|
|
),
|
|
|
|
]
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
2022-05-18 18:41:08 +02:00
|
|
|
def test_parse_file(test_input: str, expected: Compose) -> None:
|
2022-05-07 18:42:14 +02:00
|
|
|
parser = Parser()
|
2022-05-18 06:19:21 +02:00
|
|
|
actual = parser.parse(test_input)
|
2022-05-07 18:42:14 +02:00
|
|
|
|
2022-05-14 20:42:27 +02:00
|
|
|
assert len(actual.services) == len(expected.services)
|
|
|
|
|
|
|
|
for actual_service, expected_service in zip(actual.services, expected.services):
|
|
|
|
assert actual_service.name == expected_service.name
|
|
|
|
assert actual_service.image == expected_service.image
|
|
|
|
assert actual_service.ports == expected_service.ports
|
|
|
|
assert actual_service.networks == expected_service.networks
|
2022-05-21 11:41:26 +02:00
|
|
|
|
|
|
|
assert len(actual_service.volumes) == len(expected_service.volumes)
|
|
|
|
for actual_volume, expected_volume in zip(actual_service.volumes, expected_service.volumes):
|
|
|
|
assert actual_volume.source == expected_volume.source
|
|
|
|
assert actual_volume.target == expected_volume.target
|
|
|
|
assert actual_volume.type == expected_volume.type
|
|
|
|
|
2022-05-14 20:42:27 +02:00
|
|
|
assert actual_service.depends_on == expected_service.depends_on
|
|
|
|
assert actual_service.links == expected_service.links
|
2022-05-19 10:06:16 +02:00
|
|
|
|
|
|
|
assert (actual_service.extends is not None) == (expected_service.extends is not None)
|
|
|
|
|
|
|
|
if (actual_service.extends is not None) and (expected_service.extends is not None):
|
|
|
|
assert actual_service.extends.service_name == expected_service.extends.service_name
|
|
|
|
assert actual_service.extends.from_file == expected_service.extends.from_file
|