Move test-related Docker files to tests/docker

This commit is contained in:
Jan Jakeš
2019-01-23 15:31:09 +01:00
committed by wxa
parent a8aa4c1afd
commit 4bd38f8e89
6 changed files with 25 additions and 12 deletions

View File

@ -148,6 +148,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_1 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_1 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -165,6 +166,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_2 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_2 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -182,6 +184,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_3 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_3 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -199,6 +202,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_4 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 codeception -g acceptance_group_4 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -216,6 +220,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_1 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_1 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -233,6 +238,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_2 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_2 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -250,6 +256,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_3 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_3 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output
@ -267,6 +274,7 @@ jobs:
- run: - run:
name: Run acceptance tests name: Run acceptance tests
command: | command: |
cd tests/docker
docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_4 --steps --debug -vvv --html --xml docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception -g acceptance_group_4 --steps --debug -vvv --html --xml
- store_artifacts: - store_artifacts:
path: tests/_output path: tests/_output

View File

@ -257,28 +257,30 @@ class RoboFile extends \Robo\Tasks {
} }
function testAcceptance($opts=['file' => null, 'skip-deps' => false, 'timeout' => null]) { function testAcceptance($opts=['file' => null, 'skip-deps' => false, 'timeout' => null]) {
return $this->_exec( return $this->taskExec(
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' . 'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') . ($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
($opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') . ($opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') .
'codeception --steps --debug -vvv ' . 'codeception --steps --debug -vvv ' .
'-f ' . ($opts['file'] ? $opts['file'] : '') '-f ' . ($opts['file'] ? $opts['file'] : '')
); )->dir(__DIR__ . '/tests/docker')->run();
} }
function testAcceptanceMultisite($opts=['file' => null, 'skip-deps' => false, 'timeout' => null]) { function testAcceptanceMultisite($opts=['file' => null, 'skip-deps' => false, 'timeout' => null]) {
return $this->_exec( return $this->taskExec(
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' . 'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') . ($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
($opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') . ($opts['timeout'] ? '-e WAIT_TIMEOUT=' . (int)$opts['timeout'] . ' ' : '') .
'-e MULTISITE=1 ' . '-e MULTISITE=1 ' .
'codeception --steps --debug -vvv' . 'codeception --steps --debug -vvv' .
'-f ' . ($opts['file'] ? $opts['file'] : '') '-f ' . ($opts['file'] ? $opts['file'] : '')
); )->dir(__DIR__ . '/tests/docker')->run();
} }
function deleteDocker() { function deleteDocker() {
return $this->_exec('docker-compose down -v --remove-orphans --rmi all'); return $this->taskExec(
'docker-compose down -v --remove-orphans --rmi all'
)->dir(__DIR__ . '/tests/docker')->run();
} }
function testFailedUnit() { function testFailedUnit() {

View File

@ -7,6 +7,6 @@ RUN composer global require --optimize-autoloader "hirak/prestissimo"
WORKDIR /wp-core/wp-content/plugins/mailpoet WORKDIR /wp-core/wp-content/plugins/mailpoet
ENV WP_ROOT=/wp-core ENV WP_ROOT=/wp-core
ADD docker-entrypoint.sh / ADD tests/docker/codeception/docker-entrypoint.sh /
RUN ["chmod", "+x", "/docker-entrypoint.sh"] RUN ["chmod", "+x", "/docker-entrypoint.sh"]

View File

@ -2,16 +2,18 @@ version: '2.1'
services: services:
codeception: codeception:
build: . build:
context: ../..
dockerfile: tests/docker/codeception/Dockerfile
depends_on: depends_on:
mailhog: mailhog:
condition: service_started condition: service_started
wordpress: wordpress:
condition: service_healthy condition: service_healthy
volumes: volumes:
- ./:/project - ../..:/project
- wp-core:/wp-core - wp-core:/wp-core
- ./:/wp-core/wp-content/plugins/mailpoet - ../..:/wp-core/wp-content/plugins/mailpoet
entrypoint: /docker-entrypoint.sh entrypoint: /docker-entrypoint.sh
mailhog: mailhog:
@ -21,8 +23,9 @@ services:
- 8025:8025 - 8025:8025
wordpress: wordpress:
build: ./tests/wordpressDockerfile build:
image: wordpress:latest context: ../..
dockerfile: tests/docker/wordpress/Dockerfile
depends_on: depends_on:
mysql: mysql:
condition: service_healthy condition: service_healthy
@ -30,7 +33,7 @@ services:
condition: service_started condition: service_started
volumes: volumes:
- wp-core:/var/www/html - wp-core:/var/www/html
- ./:/var/www/html/wp-content/plugins/mailpoet - ../..:/var/www/html/wp-content/plugins/mailpoet
- /tmp:/var/www/html/wp-content/uploads/mailpoet/cache - /tmp:/var/www/html/wp-content/uploads/mailpoet/cache
ports: ports:
- 8080:80 - 8080:80