From 65bed53eb9912ecd3fdaaf1c5b14a12f98b60b2f Mon Sep 17 00:00:00 2001 From: Mark Vrijlandt Date: Thu, 27 Jun 2024 17:43:45 +0200 Subject: [PATCH] add option to run and system test with local code --- docker-compose.override.dev.yml | 7 +++++++ scripts/start-dev.sh | 6 ++++++ scripts/test_system_dev.sh | 16 ++++++++++++++++ system_tests/dev.Dockerfile | 15 +++++++++++++++ system_tests/docker-compose.override.dev.yml | 5 +++++ 5 files changed, 49 insertions(+) create mode 100644 docker-compose.override.dev.yml create mode 100755 scripts/start-dev.sh create mode 100755 scripts/test_system_dev.sh create mode 100644 system_tests/dev.Dockerfile create mode 100644 system_tests/docker-compose.override.dev.yml diff --git a/docker-compose.override.dev.yml b/docker-compose.override.dev.yml new file mode 100644 index 0000000..7f310c9 --- /dev/null +++ b/docker-compose.override.dev.yml @@ -0,0 +1,7 @@ +services: + + orchestrator: + image: omotes-orchestrator-dev + build: + context: .. + dockerfile: orchestrator/dev.Dockerfile diff --git a/scripts/start-dev.sh b/scripts/start-dev.sh new file mode 100755 index 0000000..2e5dc34 --- /dev/null +++ b/scripts/start-dev.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +. scripts/_select_docker_compose.sh + +$DOCKER_COMPOSE --profile=manual_dev down orchestrator_postgres_db_dev +$DOCKER_COMPOSE --profile=manual_dev -f docker-compose.yml -f docker-compose.override.dev.yml up --build --wait diff --git a/scripts/test_system_dev.sh b/scripts/test_system_dev.sh new file mode 100755 index 0000000..462a0ac --- /dev/null +++ b/scripts/test_system_dev.sh @@ -0,0 +1,16 @@ +#!/bin/bash +. scripts/_select_docker_compose.sh + +export COMPOSE_PROJECT_NAME=omotes_system_tests + +ENV_FILE=".env.test" +DOCKER_COMPOSE_FILE="./docker-compose.yml -f system_tests/docker-compose.override.yml -f system_tests/docker-compose.override.dev.yml" + +cp .env-template ${ENV_FILE} +sed -i 's/LOG_LEVEL=[a-z]*/LOG_LEVEL=WARNING/gi' ${ENV_FILE} + +$DOCKER_COMPOSE --env-file ${ENV_FILE} -f $DOCKER_COMPOSE_FILE down -v +./scripts/setup_orchestrator_postgres_db.sh $ENV_FILE $DOCKER_COMPOSE_FILE +./scripts/setup_rabbitmq.sh $ENV_FILE $DOCKER_COMPOSE_FILE +./scripts/setup_influxdb.sh $ENV_FILE $DOCKER_COMPOSE_FILE +$DOCKER_COMPOSE --env-file ${ENV_FILE} -f $DOCKER_COMPOSE_FILE up --build --abort-on-container-exit diff --git a/system_tests/dev.Dockerfile b/system_tests/dev.Dockerfile new file mode 100644 index 0000000..b85be76 --- /dev/null +++ b/system_tests/dev.Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.11-slim + +WORKDIR /app + +COPY computation-engine/system_tests/requirements.txt /app/requirements.txt +RUN pip install -r /app/requirements.txt --no-cache-dir + +COPY ../omotes-sdk-protocol/python/ /omotes-sdk-protocol/python/ +COPY ../omotes-sdk-python/ /omotes-sdk-python/ +RUN pip install -e /omotes-sdk-python/ +RUN pip install -e /omotes-sdk-protocol/python/ + +COPY computation-engine/system_tests/src/ /app/ + +CMD ["pytest", "--timeout", "120"] diff --git a/system_tests/docker-compose.override.dev.yml b/system_tests/docker-compose.override.dev.yml new file mode 100644 index 0000000..ef46e17 --- /dev/null +++ b/system_tests/docker-compose.override.dev.yml @@ -0,0 +1,5 @@ +services: + system_tests: + build: + context: .. + dockerfile: computation-engine/system_tests/dev.Dockerfile # This is referenced from root of repo due to how docker-compose works.