diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..81ee380 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Switch to Current Branch + run: git checkout ${{ env.BRANCH }} + + - name: Setup Python 3.10.4 + uses: actions/setup-python@v3 + with: + python-version: '3.10.4' + + - name: Validate Test Files + run: | + docker-compose -f tests/in/000001.yaml config -q + docker-compose -f tests/in/000010.yaml config -q + docker-compose -f tests/in/000011.yaml config -q + docker-compose -f tests/in/000100.yaml config -q + docker-compose -f tests/in/000101.yaml config -q + docker-compose -f tests/in/000110.yaml config -q + docker-compose -f tests/in/000111.yaml config -q + docker-compose -f tests/in/001000.yaml config -q + docker-compose -f tests/in/001001.yaml config -q + docker-compose -f tests/in/001010.yaml config -q + docker-compose -f tests/in/001011.yaml config -q + docker-compose -f tests/in/001100.yaml config -q + docker-compose -f tests/in/001101.yaml config -q + docker-compose -f tests/in/001110.yaml config -q + docker-compose -f tests/in/001111.yaml config -q + docker-compose -f tests/in/010000.yaml config -q + docker-compose -f tests/in/010001.yaml config -q + docker-compose -f tests/in/010010.yaml config -q + docker-compose -f tests/in/010011.yaml config -q + docker-compose -f tests/in/010100.yaml config -q + docker-compose -f tests/in/010101.yaml config -q + docker-compose -f tests/in/010110.yaml config -q + docker-compose -f tests/in/010111.yaml config -q + docker-compose -f tests/in/011000.yaml config -q + docker-compose -f tests/in/011001.yaml config -q + docker-compose -f tests/in/011010.yaml config -q + docker-compose -f tests/in/011011.yaml config -q + docker-compose -f tests/in/011100.yaml config -q + docker-compose -f tests/in/011101.yaml config -q + docker-compose -f tests/in/011110.yaml config -q + docker-compose -f tests/in/011111.yaml config -q + docker-compose -f tests/in/100000.yaml config -q + docker-compose -f tests/in/100001.yaml config -q + docker-compose -f tests/in/100010.yaml config -q + docker-compose -f tests/in/100011.yaml config -q + docker-compose -f tests/in/100100.yaml config -q + docker-compose -f tests/in/100101.yaml config -q + docker-compose -f tests/in/100110.yaml config -q + docker-compose -f tests/in/100111.yaml config -q + docker-compose -f tests/in/101000.yaml config -q + docker-compose -f tests/in/101001.yaml config -q + docker-compose -f tests/in/101010.yaml config -q + docker-compose -f tests/in/101011.yaml config -q + docker-compose -f tests/in/101100.yaml config -q + docker-compose -f tests/in/101101.yaml config -q + docker-compose -f tests/in/101110.yaml config -q + docker-compose -f tests/in/101111.yaml config -q + docker-compose -f tests/in/110000.yaml config -q + docker-compose -f tests/in/110001.yaml config -q + docker-compose -f tests/in/110010.yaml config -q + docker-compose -f tests/in/110011.yaml config -q + docker-compose -f tests/in/110100.yaml config -q + docker-compose -f tests/in/110101.yaml config -q + docker-compose -f tests/in/110110.yaml config -q + docker-compose -f tests/in/110111.yaml config -q + docker-compose -f tests/in/111000.yaml config -q + docker-compose -f tests/in/111001.yaml config -q + docker-compose -f tests/in/111010.yaml config -q + docker-compose -f tests/in/111011.yaml config -q + docker-compose -f tests/in/111100.yaml config -q + docker-compose -f tests/in/111101.yaml config -q + docker-compose -f tests/in/111110.yaml config -q + docker-compose -f tests/in/111111.yaml config -q + + - name: Validate Custom Input File + run: | + pip install pytest + pip install pytest-cov + pytest + python .\tests\test_validate_input_file.py .\tests\validate_input_file.py .\tests\in\docker-compose.yaml diff --git a/tests/in/000001.yaml b/tests/in/000001.yaml new file mode 100644 index 0000000..1683eba --- /dev/null +++ b/tests/in/000001.yaml @@ -0,0 +1,26 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/000010.yaml b/tests/in/000010.yaml new file mode 100644 index 0000000..1bb47e2 --- /dev/null +++ b/tests/in/000010.yaml @@ -0,0 +1,11 @@ +services: + base: + image: busybox + user: root + common: + image: busybox + extends: + service: base + cli: + extends: + service: common \ No newline at end of file diff --git a/tests/in/000011.yaml b/tests/in/000011.yaml new file mode 100644 index 0000000..2336456 --- /dev/null +++ b/tests/in/000011.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + extends: + service: frontend + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + extends: + service: frontend + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/000100.yaml b/tests/in/000100.yaml new file mode 100644 index 0000000..34c09b1 --- /dev/null +++ b/tests/in/000100.yaml @@ -0,0 +1,8 @@ +version: "3.9" +services: + web: + build: . + ports: + - "8000:5000" + redis: + image: "redis:alpine" \ No newline at end of file diff --git a/tests/in/000101.yaml b/tests/in/000101.yaml new file mode 100644 index 0000000..6d1ce63 --- /dev/null +++ b/tests/in/000101.yaml @@ -0,0 +1,32 @@ +services: + frontend: + image: awesome/webapp + ports: + - "8000:5000" + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + ports: + - "8000:5001" + networks: + - admin + + backend: + image: awesome/backend + ports: + - "8000:5010" + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/000110.yaml b/tests/in/000110.yaml new file mode 100644 index 0000000..9ac40e0 --- /dev/null +++ b/tests/in/000110.yaml @@ -0,0 +1,17 @@ +services: + frontend: + image: awesome/webapp + ports: + - "8000:5000" + + monitoring: + image: awesome/monitoring + extends: + service: frontend + + backend: + image: awesome/backend + extends: + service: frontend + ports: + - "8000:5001" \ No newline at end of file diff --git a/tests/in/000111.yaml b/tests/in/000111.yaml new file mode 100644 index 0000000..42fab6c --- /dev/null +++ b/tests/in/000111.yaml @@ -0,0 +1,34 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + ports: + - "8000:5000" + + monitoring: + image: awesome/monitoring + networks: + - admin + extends: + service: frontend + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + extends: + service: frontend + ports: + - "8000:5001" + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/001000.yaml b/tests/in/001000.yaml new file mode 100644 index 0000000..51adbed --- /dev/null +++ b/tests/in/001000.yaml @@ -0,0 +1,10 @@ +services: + web: + build: . + depends_on: + - db + - redis + redis: + image: redis + db: + image: postgres \ No newline at end of file diff --git a/tests/in/001001.yaml b/tests/in/001001.yaml new file mode 100644 index 0000000..37a10e0 --- /dev/null +++ b/tests/in/001001.yaml @@ -0,0 +1,29 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + depends_on: + - monitoring + - backend + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/001010.yaml b/tests/in/001010.yaml new file mode 100644 index 0000000..a598e6b --- /dev/null +++ b/tests/in/001010.yaml @@ -0,0 +1,12 @@ +services: + web: + build: . + depends_on: + - db + - redis + extends: + service: redis + redis: + image: redis + db: + image: postgres \ No newline at end of file diff --git a/tests/in/001011.yaml b/tests/in/001011.yaml new file mode 100644 index 0000000..7ef900c --- /dev/null +++ b/tests/in/001011.yaml @@ -0,0 +1,31 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + depends_on: + - monitoring + - backend + extends: + service: backend + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/001100.yaml b/tests/in/001100.yaml new file mode 100644 index 0000000..e3219c8 --- /dev/null +++ b/tests/in/001100.yaml @@ -0,0 +1,17 @@ +services: + frontend: + image: awesome/webapp + ports: + - "8000:5000" + + monitoring: + image: awesome/monitoring + depends_on: + - backend + ports: + - "8000:5010" + + backend: + image: awesome/backend + ports: + - "8000:5001" \ No newline at end of file diff --git a/tests/in/001101.yaml b/tests/in/001101.yaml new file mode 100644 index 0000000..417fe7f --- /dev/null +++ b/tests/in/001101.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + depends_on: + - backend + ports: + - "8000:5010" + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/001110.yaml b/tests/in/001110.yaml new file mode 100644 index 0000000..187d4b9 --- /dev/null +++ b/tests/in/001110.yaml @@ -0,0 +1,21 @@ +services: + frontend: + image: awesome/webapp + ports: + - "8000:5000" + + monitoring: + image: awesome/monitoring + depends_on: + - backend + extends: + service: frontend + ports: + - "8000:5010" + + backend: + image: awesome/backend + extends: + service: frontend + ports: + - "8000:5001" \ No newline at end of file diff --git a/tests/in/001111.yaml b/tests/in/001111.yaml new file mode 100644 index 0000000..332ed69 --- /dev/null +++ b/tests/in/001111.yaml @@ -0,0 +1,32 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + depends_on: + - backend + extends: + service: frontend + ports: + - "8000:5010" + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/010000.yaml b/tests/in/010000.yaml new file mode 100644 index 0000000..b1c39d7 --- /dev/null +++ b/tests/in/010000.yaml @@ -0,0 +1,15 @@ +services: + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010001.yaml b/tests/in/010001.yaml new file mode 100644 index 0000000..74bd2ea --- /dev/null +++ b/tests/in/010001.yaml @@ -0,0 +1,37 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010010.yaml b/tests/in/010010.yaml new file mode 100644 index 0000000..bd14c8f --- /dev/null +++ b/tests/in/010010.yaml @@ -0,0 +1,13 @@ +services: + common: + image: busybox + volumes: + - common-volume:/var/lib/backup/data:rw + cli: + extends: + service: common + volumes: + - cli-volume:/var/lib/backup/data:ro +volumes: + common-volume: + cli-volume: \ No newline at end of file diff --git a/tests/in/010011.yaml b/tests/in/010011.yaml new file mode 100644 index 0000000..fad0350 --- /dev/null +++ b/tests/in/010011.yaml @@ -0,0 +1,39 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: monitoring + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010100.yaml b/tests/in/010100.yaml new file mode 100644 index 0000000..de377ee --- /dev/null +++ b/tests/in/010100.yaml @@ -0,0 +1,16 @@ +services: + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + ports: + - "8000:5000" +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010101.yaml b/tests/in/010101.yaml new file mode 100644 index 0000000..86a28b1 --- /dev/null +++ b/tests/in/010101.yaml @@ -0,0 +1,39 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + ports: + - "8000:5000" + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010110.yaml b/tests/in/010110.yaml new file mode 100644 index 0000000..ef63463 --- /dev/null +++ b/tests/in/010110.yaml @@ -0,0 +1,24 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: monitoring + ports: + - "8000:5000" +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/010111.yaml b/tests/in/010111.yaml new file mode 100644 index 0000000..b3d9888 --- /dev/null +++ b/tests/in/010111.yaml @@ -0,0 +1,41 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: monitoring + ports: + - "8000:5000" + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011000.yaml b/tests/in/011000.yaml new file mode 100644 index 0000000..4ef3c19 --- /dev/null +++ b/tests/in/011000.yaml @@ -0,0 +1,22 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + depends_on: + - backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + + backend: + image: awesome/backend +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011001.yaml b/tests/in/011001.yaml new file mode 100644 index 0000000..023ab8c --- /dev/null +++ b/tests/in/011001.yaml @@ -0,0 +1,40 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011010.yaml b/tests/in/011010.yaml new file mode 100644 index 0000000..a65c17e --- /dev/null +++ b/tests/in/011010.yaml @@ -0,0 +1,26 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011011.yaml b/tests/in/011011.yaml new file mode 100644 index 0000000..67bfde1 --- /dev/null +++ b/tests/in/011011.yaml @@ -0,0 +1,42 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011100.yaml b/tests/in/011100.yaml new file mode 100644 index 0000000..dbebc65 --- /dev/null +++ b/tests/in/011100.yaml @@ -0,0 +1,28 @@ +services: + frontend: + image: awesome/webapp + ports: + - "8000:5000" + + monitoring: + image: awesome/monitoring + depends_on: + - backend + ports: + - "8000:5010" + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + + backend: + image: awesome/backend + ports: + - "8000:5001" +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011101.yaml b/tests/in/011101.yaml new file mode 100644 index 0000000..dd833f4 --- /dev/null +++ b/tests/in/011101.yaml @@ -0,0 +1,74 @@ +services: + vote: + build: ./ + # use python rather than gunicorn for local dev + command: python app.py + depends_on: + redis: + condition: service_healthy + volumes: + - app + ports: + - "5000:80" + networks: + - front-tier + - back-tier + + result: + build: ./ + # use nodemon rather than node for local dev + command: nodemon server.js + depends_on: + db: + condition: service_healthy + volumes: + - app + ports: + - "5001:80" + - "5858:5858" + networks: + - front-tier + - back-tier + + worker: + build: + context: ./ + depends_on: + redis: + condition: service_healthy + db: + condition: service_healthy + networks: + - back-tier + + redis: + image: redis:5.0-alpine3.10 + volumes: + - "./healthchecks:/healthchecks" + healthcheck: + test: /healthchecks/redis.sh + interval: "5s" + ports: ["6379"] + networks: + - back-tier + + db: + image: postgres:9.4 + environment: + POSTGRES_USER: "postgres" + POSTGRES_PASSWORD: "postgres" + volumes: + - "db-data:/var/lib/postgresql/data" + - "./healthchecks:/healthchecks" + healthcheck: + test: /healthchecks/postgres.sh + interval: "5s" + networks: + - back-tier + +volumes: + db-data: + +networks: + front-tier: + back-tier: diff --git a/tests/in/011110.yaml b/tests/in/011110.yaml new file mode 100644 index 0000000..97f8c0d --- /dev/null +++ b/tests/in/011110.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + + + monitoring: + image: awesome/monitoring + + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/011111.yaml b/tests/in/011111.yaml new file mode 100644 index 0000000..797150d --- /dev/null +++ b/tests/in/011111.yaml @@ -0,0 +1,44 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/100000.yaml b/tests/in/100000.yaml new file mode 100644 index 0000000..c214153 --- /dev/null +++ b/tests/in/100000.yaml @@ -0,0 +1,9 @@ +version: "3.9" +services: + + web: + build: . + links: + - "db:database" + db: + image: postgres \ No newline at end of file diff --git a/tests/in/100001.yaml b/tests/in/100001.yaml new file mode 100644 index 0000000..82a5fa2 --- /dev/null +++ b/tests/in/100001.yaml @@ -0,0 +1,31 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/100010.yaml b/tests/in/100010.yaml new file mode 100644 index 0000000..5f72c8a --- /dev/null +++ b/tests/in/100010.yaml @@ -0,0 +1,16 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + extends: + service: frontend + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/100011.yaml b/tests/in/100011.yaml new file mode 100644 index 0000000..bbd4fd2 --- /dev/null +++ b/tests/in/100011.yaml @@ -0,0 +1,33 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/100100.yaml b/tests/in/100100.yaml new file mode 100644 index 0000000..4640d65 --- /dev/null +++ b/tests/in/100100.yaml @@ -0,0 +1,16 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/100101.yaml b/tests/in/100101.yaml new file mode 100644 index 0000000..bf6cac2 --- /dev/null +++ b/tests/in/100101.yaml @@ -0,0 +1,33 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/100110.yaml b/tests/in/100110.yaml new file mode 100644 index 0000000..34b31ca --- /dev/null +++ b/tests/in/100110.yaml @@ -0,0 +1,18 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/100111.yaml b/tests/in/100111.yaml new file mode 100644 index 0000000..3c718f8 --- /dev/null +++ b/tests/in/100111.yaml @@ -0,0 +1,35 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/101000.yaml b/tests/in/101000.yaml new file mode 100644 index 0000000..72d5f8c --- /dev/null +++ b/tests/in/101000.yaml @@ -0,0 +1,16 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + depends_on: + - monitoring + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/101001.yaml b/tests/in/101001.yaml new file mode 100644 index 0000000..a01f7ae --- /dev/null +++ b/tests/in/101001.yaml @@ -0,0 +1,33 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + depends_on: + - monitoring + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/101010.yaml b/tests/in/101010.yaml new file mode 100644 index 0000000..ec3ee66 --- /dev/null +++ b/tests/in/101010.yaml @@ -0,0 +1,18 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + depends_on: + - monitoring + links: + - "db:database" + extends: + service: frontend + db: + image: postgres diff --git a/tests/in/101011.yaml b/tests/in/101011.yaml new file mode 100644 index 0000000..3b42bb5 --- /dev/null +++ b/tests/in/101011.yaml @@ -0,0 +1,35 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + depends_on: + - monitoring + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/101100.yaml b/tests/in/101100.yaml new file mode 100644 index 0000000..b08993e --- /dev/null +++ b/tests/in/101100.yaml @@ -0,0 +1,18 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + depends_on: + - monitoring + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/101101.yaml b/tests/in/101101.yaml new file mode 100644 index 0000000..8b521fe --- /dev/null +++ b/tests/in/101101.yaml @@ -0,0 +1,35 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + depends_on: + - monitoring + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/101110.yaml b/tests/in/101110.yaml new file mode 100644 index 0000000..6428644 --- /dev/null +++ b/tests/in/101110.yaml @@ -0,0 +1,21 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + + backend: + image: awesome/backend + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres diff --git a/tests/in/101111.yaml b/tests/in/101111.yaml new file mode 100644 index 0000000..ce845ca --- /dev/null +++ b/tests/in/101111.yaml @@ -0,0 +1,37 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: \ No newline at end of file diff --git a/tests/in/110000.yaml b/tests/in/110000.yaml new file mode 100644 index 0000000..b07f8ff --- /dev/null +++ b/tests/in/110000.yaml @@ -0,0 +1,24 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + links: + - "db:database" + + backend: + image: awesome/backend + db: + image: postgres +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110001.yaml b/tests/in/110001.yaml new file mode 100644 index 0000000..6475de2 --- /dev/null +++ b/tests/in/110001.yaml @@ -0,0 +1,42 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110010.yaml b/tests/in/110010.yaml new file mode 100644 index 0000000..297dddd --- /dev/null +++ b/tests/in/110010.yaml @@ -0,0 +1,28 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110011.yaml b/tests/in/110011.yaml new file mode 100644 index 0000000..8778ea3 --- /dev/null +++ b/tests/in/110011.yaml @@ -0,0 +1,44 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110100.yaml b/tests/in/110100.yaml new file mode 100644 index 0000000..9ef067c --- /dev/null +++ b/tests/in/110100.yaml @@ -0,0 +1,28 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110101.yaml b/tests/in/110101.yaml new file mode 100644 index 0000000..2a8000c --- /dev/null +++ b/tests/in/110101.yaml @@ -0,0 +1,44 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110110.yaml b/tests/in/110110.yaml new file mode 100644 index 0000000..72f8a30 --- /dev/null +++ b/tests/in/110110.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/110111.yaml b/tests/in/110111.yaml new file mode 100644 index 0000000..0bda8ef --- /dev/null +++ b/tests/in/110111.yaml @@ -0,0 +1,46 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111000.yaml b/tests/in/111000.yaml new file mode 100644 index 0000000..24483e4 --- /dev/null +++ b/tests/in/111000.yaml @@ -0,0 +1,26 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + depends_on: + - backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + links: + - "db:database" + + backend: + image: awesome/backend + db: + image: postgres +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111001.yaml b/tests/in/111001.yaml new file mode 100644 index 0000000..b6acfed --- /dev/null +++ b/tests/in/111001.yaml @@ -0,0 +1,44 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111010.yaml b/tests/in/111010.yaml new file mode 100644 index 0000000..fcd05b9 --- /dev/null +++ b/tests/in/111010.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111011.yaml b/tests/in/111011.yaml new file mode 100644 index 0000000..1fbf1b1 --- /dev/null +++ b/tests/in/111011.yaml @@ -0,0 +1,46 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111100.yaml b/tests/in/111100.yaml new file mode 100644 index 0000000..23c650b --- /dev/null +++ b/tests/in/111100.yaml @@ -0,0 +1,30 @@ +services: + frontend: + image: awesome/webapp + + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111101.yaml b/tests/in/111101.yaml new file mode 100644 index 0000000..79ebf03 --- /dev/null +++ b/tests/in/111101.yaml @@ -0,0 +1,46 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111110.yaml b/tests/in/111110.yaml new file mode 100644 index 0000000..4250938 --- /dev/null +++ b/tests/in/111110.yaml @@ -0,0 +1,31 @@ +services: + frontend: + image: awesome/webapp + monitoring: + image: awesome/monitoring + + + backend: + image: awesome/backend + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/111111.yaml b/tests/in/111111.yaml new file mode 100644 index 0000000..e506c33 --- /dev/null +++ b/tests/in/111111.yaml @@ -0,0 +1,48 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: \ No newline at end of file diff --git a/tests/in/docker-compose.yaml b/tests/in/docker-compose.yaml new file mode 100644 index 0000000..3f94ba7 --- /dev/null +++ b/tests/in/docker-compose.yaml @@ -0,0 +1,48 @@ +services: + frontend: + image: awesome/webapp + networks: + - front-tier + - back-tier + + monitoring: + image: awesome/monitoring + networks: + - admin + + + backend: + image: awesome/backend + networks: + back-tier: + aliases: + - database + admin: + aliases: + - mysql + volumes: + - type: volume + source: db-data + target: /data + volume: + nocopy: true + - type: bind + source: /var/run/postgres/postgres.sock + target: /var/run/postgres/postgres.sock + depends_on: + - monitoring + extends: + service: frontend + ports: + - "8000:5010" + links: + - "db:database" + db: + image: postgres + +networks: + front-tier: + back-tier: + admin: +volumes: + db-data: diff --git a/tests/test_validate_input_file.py b/tests/test_validate_input_file.py new file mode 100644 index 0000000..54140c0 --- /dev/null +++ b/tests/test_validate_input_file.py @@ -0,0 +1,5 @@ +import sys +import pytest + +if __name__ == '__main__': + pytest.main([sys.argv[1]]) \ No newline at end of file diff --git a/tests/validate_input_file.py b/tests/validate_input_file.py new file mode 100644 index 0000000..73a4f3e --- /dev/null +++ b/tests/validate_input_file.py @@ -0,0 +1,6 @@ +import os +import sys + +def test_validate_input_file(): + process = os.system("docker-compose -f " + sys.argv[2] + " config -q") + assert process == 0 \ No newline at end of file