[TESTS] Move testing container's DB and Redis to different ports, so it can be used at the same time as the regular containers

This commit is contained in:
Hugo Sales 2021-05-02 14:49:34 +00:00
parent ee97cc5b00
commit 5d326bd18e
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
6 changed files with 64 additions and 2 deletions

View File

@ -3,4 +3,4 @@ KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st' APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999 SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther PANTHER_APP_ENV=panther
DATABASE_URL=postgresql://postgres:password@db:5432/social DATABASE_URL=postgresql://postgres:password@db:54320/social

4
.gitignore vendored
View File

@ -43,6 +43,10 @@ docker/mail/config/passwd.db
docker/mail/etc/service/* docker/mail/etc/service/*
!docker/mail/etc/service/*/run !docker/mail/etc/service/*/run
!docker/testing/*
!docker/testing/docker-compose.yaml
docker/testing/*~
docker-compose.yaml docker-compose.yaml
composer.local.json composer.local.json

View File

@ -1,3 +1,6 @@
test: 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

4
docker/testing/db.env Normal file
View File

@ -0,0 +1,4 @@
DBMS=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=social

View File

@ -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:

10
docker/testing/social.env Normal file
View File

@ -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