test: update test files to test ports and volumes in compose spec

This commit is contained in:
Xyphuz 2022-05-23 02:41:00 +08:00
parent 914827e928
commit 4424aae3ae
5 changed files with 15 additions and 16 deletions

View file

@ -3,6 +3,6 @@ services:
web: web:
build: . build: .
ports: ports:
- "8000:5000" - "8080"
redis: redis:
image: "redis:alpine" image: "redis:alpine"

View file

@ -2,7 +2,10 @@ services:
frontend: frontend:
image: awesome/webapp image: awesome/webapp
ports: ports:
- "8000:5000" - target: 80
host_ip: 127.0.0.1
published: 8080
protocol: udp
networks: networks:
- front-tier - front-tier
- back-tier - back-tier
@ -10,14 +13,14 @@ services:
monitoring: monitoring:
image: awesome/monitoring image: awesome/monitoring
ports: ports:
- "8000:5001" - "127.0.0.1:8081:5001"
networks: networks:
- admin - admin
backend: backend:
image: awesome/backend image: awesome/backend
ports: ports:
- "8000:5010" - "8000:5010/udp"
networks: networks:
back-tier: back-tier:
aliases: aliases:

View file

@ -2,7 +2,7 @@ services:
frontend: frontend:
image: awesome/webapp image: awesome/webapp
ports: ports:
- "8000:5000" - target: 80
monitoring: monitoring:
extends: extends:

View file

@ -2,11 +2,7 @@ services:
backend: backend:
image: awesome/backend image: awesome/backend
volumes: volumes:
- type: volume - "db-data:/data"
source: db-data
target: /data
volume:
nocopy: true
- type: bind - type: bind
source: /var/run/postgres/postgres.sock source: /var/run/postgres/postgres.sock
target: /var/run/postgres/postgres.sock target: /var/run/postgres/postgres.sock

View file

@ -3,7 +3,7 @@ import pytest
from compose_viz.compose import Compose from compose_viz.compose import Compose
from compose_viz.extends import Extends from compose_viz.extends import Extends
from compose_viz.parser import Parser from compose_viz.parser import Parser
from compose_viz.port import Port from compose_viz.port import Port, Protocol
from compose_viz.service import Service from compose_viz.service import Service
from compose_viz.volume import AccessMode, Volume, VolumeType from compose_viz.volume import AccessMode, Volume, VolumeType
@ -82,7 +82,7 @@ from compose_viz.volume import AccessMode, Volume, VolumeType
name="web", name="web",
image="build from .", image="build from .",
ports=[ ports=[
Port(host_port="8000", container_port="5000"), Port(host_port="8080", container_port="8080"),
], ],
), ),
Service( Service(
@ -100,7 +100,7 @@ from compose_viz.volume import AccessMode, Volume, VolumeType
name="frontend", name="frontend",
image="awesome/webapp", image="awesome/webapp",
ports=[ ports=[
Port(host_port="8000", container_port="5000"), Port(host_port="127.0.0.1:8080", container_port="80", protocol=Protocol.udp),
], ],
networks=["front-tier", "back-tier"], networks=["front-tier", "back-tier"],
), ),
@ -108,7 +108,7 @@ from compose_viz.volume import AccessMode, Volume, VolumeType
name="monitoring", name="monitoring",
image="awesome/monitoring", image="awesome/monitoring",
ports=[ ports=[
Port(host_port="8000", container_port="5001"), Port(host_port="127.0.0.1:8081", container_port="5001"),
], ],
networks=["admin"], networks=["admin"],
), ),
@ -116,7 +116,7 @@ from compose_viz.volume import AccessMode, Volume, VolumeType
name="backend", name="backend",
image="awesome/backend", image="awesome/backend",
ports=[ ports=[
Port(host_port="8000", container_port="5010"), Port(host_port="8000", container_port="5010", protocol=Protocol.udp),
], ],
networks=["back-tier", "admin"], networks=["back-tier", "admin"],
), ),
@ -131,7 +131,7 @@ from compose_viz.volume import AccessMode, Volume, VolumeType
name="frontend", name="frontend",
image="awesome/webapp", image="awesome/webapp",
ports=[ ports=[
Port(host_port="8000", container_port="5000"), Port(host_port="80", container_port="80"),
], ],
), ),
Service( Service(