From ade043010a1e96090a37d592e7c8c252a3494719 Mon Sep 17 00:00:00 2001 From: Dennis Siemensma Date: Mon, 17 Jun 2024 18:33:08 +0200 Subject: [PATCH] Fix CI #1594 --- .github/workflows/automated-tests.yml | 4 ++-- provisioning/container/compose.dev.yml | 12 ++++++++++++ provisioning/container/compose.test.yml | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automated-tests.yml b/.github/workflows/automated-tests.yml index d5a4b9ee..ccf3251f 100644 --- a/.github/workflows/automated-tests.yml +++ b/.github/workflows/automated-tests.yml @@ -36,7 +36,7 @@ jobs: sleep 5 - name: Check flake8 - run: docker compose exec tests-dsmr-app poetry run flake8 + run: docker compose run tests-dsmr-app poetry run flake8 -v - name: Run PostgreSQL tests - run: docker compose exec tests-dsmr-app poetry run pytest + run: docker compose run tests-dsmr-app poetry run pytest diff --git a/provisioning/container/compose.dev.yml b/provisioning/container/compose.dev.yml index aaf49368..cc3ec116 100644 --- a/provisioning/container/compose.dev.yml +++ b/provisioning/container/compose.dev.yml @@ -18,6 +18,8 @@ services: ports: - '8000:8000' depends_on: + dev-dsmr-db: + condition: service_healthy mosquitto: condition: service_started influxdb: @@ -29,6 +31,11 @@ services: container_name: dev-dsmr-db image: postgres:15-alpine restart: 'unless-stopped' + healthcheck: + test: ["CMD-SHELL", "pg_isready -U dsmrreader"] + interval: 1s + timeout: 5s + retries: 20 ports: - '5432:5432' env_file: @@ -89,6 +96,11 @@ services: container_name: tests-dsmr-db image: postgres:15-alpine restart: 'unless-stopped' + healthcheck: + test: ["CMD-SHELL", "pg_isready -U testuser"] + interval: 1s + timeout: 5s + retries: 20 environment: POSTGRES_DB: 'test_dsmrreader' POSTGRES_USER: 'testuser' diff --git a/provisioning/container/compose.test.yml b/provisioning/container/compose.test.yml index 74a805c5..da255b46 100644 --- a/provisioning/container/compose.test.yml +++ b/provisioning/container/compose.test.yml @@ -13,6 +13,7 @@ services: target: local-dsmrreader-dev volumes: - ./src:/app + - /app/.venv # Prevents mirroring it to host depends_on: tests-dsmr-db: condition: service_healthy @@ -31,7 +32,7 @@ services: image: postgres:15-alpine restart: 'unless-stopped' healthcheck: - test: ["CMD-SHELL", "pg_isready -U dsmrreader"] + test: ["CMD-SHELL", "pg_isready -U dbtestuser"] interval: 1s timeout: 5s retries: 20