From 5d326bd18e41df489575ba0c30743b81c90e976a Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Sun, 2 May 2021 14:49:34 +0000 Subject: [PATCH] [TESTS] Move testing container's DB and Redis to different ports, so it can be used at the same time as the regular containers --- .env.test | 2 +- .gitignore | 4 +++ Makefile | 5 +++- docker/testing/db.env | 4 +++ docker/testing/docker-compose.yaml | 41 ++++++++++++++++++++++++++++++ docker/testing/social.env | 10 ++++++++ 6 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 docker/testing/db.env create mode 100644 docker/testing/docker-compose.yaml create mode 100644 docker/testing/social.env diff --git a/.env.test b/.env.test index aca3bae320..ddc5b49bb4 100644 --- a/.env.test +++ b/.env.test @@ -3,4 +3,4 @@ KERNEL_CLASS='App\Kernel' APP_SECRET='$ecretf0rt3st' SYMFONY_DEPRECATIONS_HELPER=999999 PANTHER_APP_ENV=panther -DATABASE_URL=postgresql://postgres:password@db:5432/social +DATABASE_URL=postgresql://postgres:password@db:54320/social diff --git a/.gitignore b/.gitignore index 8714630358..47afab7816 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,10 @@ docker/mail/config/passwd.db docker/mail/etc/service/* !docker/mail/etc/service/*/run +!docker/testing/* +!docker/testing/docker-compose.yaml +docker/testing/*~ + docker-compose.yaml composer.local.json diff --git a/Makefile b/Makefile index b25a3b0d71..bbba90ad8a 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ test: - cd docker/testing && docker-compose run php + cd docker/testing && docker-compose run php && docker-compose down + +stop-test: + cd docker/testing && docker-compose down diff --git a/docker/testing/db.env b/docker/testing/db.env new file mode 100644 index 0000000000..d64c1672f1 --- /dev/null +++ b/docker/testing/db.env @@ -0,0 +1,4 @@ +DBMS=postgres +POSTGRES_USER=postgres +POSTGRES_PASSWORD=password +POSTGRES_DB=social \ No newline at end of file diff --git a/docker/testing/docker-compose.yaml b/docker/testing/docker-compose.yaml new file mode 100644 index 0000000000..6f733cc2e5 --- /dev/null +++ b/docker/testing/docker-compose.yaml @@ -0,0 +1,41 @@ +version: '3' + +services: + php: + build: . + depends_on: + - db + - redis + volumes: + # Entrypoint + - ../php/entrypoint.sh:/entrypoint.sh + - ../db/wait_for_db.sh:/wait_for_db.sh + - ../social/install.sh:/var/entrypoint.d/0_social_install.sh + - ./coverage.sh:/var/entrypoint.d/8_coverage.sh + # Main files + - ../../:/var/www/social + - ./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + env_file: + - social.env + - db.env + command: /entrypoint.sh + + db: + image: postgres:alpine + ports: + - 54320:5432 + environment: + - PGDATA=/var/lib/postgres/data + env_file: + - db.env + volumes: + - database:/var/lib/postgres/data + + redis: + image: redis:alpine + tty: false + ports: + - 63790:6379 + +volumes: + database: diff --git a/docker/testing/social.env b/docker/testing/social.env new file mode 100644 index 0000000000..f1558adfb3 --- /dev/null +++ b/docker/testing/social.env @@ -0,0 +1,10 @@ +SOCIAL_DBMS=postgres +SOCIAL_DB=social +SOCIAL_USER=postgres +SOCIAL_PASSWORD=password +SOCIAL_DOMAIN=social.localhost +SOCIAL_NODE_NAME=node +SOCIAL_ADMIN_EMAIL=test@localhost +SOCIAL_SITE_PROFILE=public +MAILER_DSN=sendmail://localhost +APP_ENV=test