Skip to content

Commit

Permalink
fix system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkTNO committed Oct 16, 2024
1 parent 911a844 commit d5acffd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
24 changes: 14 additions & 10 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
#!/bin/bash

ENV_FILE="./.env"
DOCKER_COMPOSE_FILE="-f ./docker-compose.yml -f ./docker-compose.override.setup.yml"
# optionally set env file and docker compose file from arguments
ENV_FILE=${1:-"./.env"}
DOCKER_COMPOSE_FILE=${2:-"./docker-compose.yml -f ./docker-compose.override.setup.yml"}

. "$(dirname "$0")"/_select_docker_compose.sh
. "$(dirname "$0")"/_load_dot_env.sh $ENV_FILE

echo "Using docker compose file at: $DOCKER_COMPOSE_FILE"

# stop system
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE --env-file $ENV_FILE --profile=manual_dev down
# stop system before setup
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE --env-file $ENV_FILE --profile=manual_dev down

# add postgres user with privileges
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE --env-file $ENV_FILE up --wait orchestrator_postgres_db
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE exec orchestrator_postgres_db psql \
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE --env-file $ENV_FILE up --wait orchestrator_postgres_db
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE exec orchestrator_postgres_db psql \
-d postgres \
-v PG_USERNAME="$POSTGRES_ORCHESTRATOR_USER_NAME" \
-v PG_PASSWORD="$POSTGRES_ORCHESTRATOR_USER_PASSWORD" \
-v PG_DB=postgres \
-f /setup/init.sql

# add rabbitmq 'omotes' and 'celery' vhosts and users
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE up --wait rabbitmq
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE exec rabbitmq /bin/sh -c "./setup/rabbitmq-init.sh"
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE up --wait rabbitmq
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE exec rabbitmq /bin/sh -c "./setup/rabbitmq-init.sh"

# add influxdb users with write access for optimizer/simulator and with admin rights
# for the frontend (root admin user via env vars)
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE up --wait omotes_influxdb
$DOCKER_COMPOSE $DOCKER_COMPOSE_FILE exec omotes_influxdb /bin/sh -c "./setup/influxdb-init.sh"
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE up --wait omotes_influxdb
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE exec omotes_influxdb /bin/sh -c "./setup/influxdb-init.sh"

# stop system after setup
$DOCKER_COMPOSE -f $DOCKER_COMPOSE_FILE --env-file $ENV_FILE down
4 changes: 1 addition & 3 deletions scripts/test_system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ 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
./scripts/setup.sh $ENV_FILE "$DOCKER_COMPOSE_FILE -f ./docker-compose.override.setup.yml"
$DOCKER_COMPOSE --env-file ${ENV_FILE} -f $DOCKER_COMPOSE_FILE up --build --abort-on-container-exit

0 comments on commit d5acffd

Please sign in to comment.