test: added all of the test

This commit is contained in:
wolfyeva 2022-05-18 22:03:52 +08:00
parent 366f605efb
commit 04535bb834

View file

@ -1,3 +1,4 @@
from os import link
import pytest
from compose_viz.parser import Parser
from compose_viz.compose import Compose
@ -465,42 +466,24 @@ from compose_viz.extends import Extends
])),
('tests/in/011101.yaml',Compose([
Service(
name='vote',
image='build from ./',
depends_on=['redis'],
volumes=['app'],
ports=['5000:80'],
networks=['front-tier','back-tier'],
name='frontend',
image='awesome/webapp',
networks=['front-tier', 'back-tier'],
),
Service(
name='result',
image='build from ./',
depends_on=['db'],
volumes=['app'],
ports=['5001:80','5858:5858'],
networks=['front-tier','back-tier'],
name='monitoring',
image='awesome/monitoring',
networks=['admin'],
),
Service(
name='worker',
image='build from ./',
depends_on=['redis','db'],
networks=['back-tier'],
),
Service(
name='redis',
image='redis:5.0-alpine3.10',
volumes=[''], #####
ports=['6379'],
networks=['back-tier'],
),
Service(
name='db',
image='postgres:9.4',
volumes=[''], #####
networks=['back-tier'],
name='backend',
image='awesome/backend',
networks=['back-tier', 'admin'],
volumes=['db-data'],
depends_on=['monitoring'],
ports=['8000:5010'],
),
])),
('tests/in/011110.yaml',Compose([
Service(
name='frontend',
@ -549,6 +532,691 @@ from compose_viz.extends import Extends
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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'],
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
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',
volumes=['db-data'],
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'],
volumes=['db-data'],
depends_on=['monitoring'],
extends=Extends(service_name='frontend'),
ports=['8000:5010'],
links=['db:database'],
),
Service(
name='db',
image='postgres',
),
])),
])
def test_parse_file(test_input, expected):