Sign inSign up

magesuite/run-tests

By magesuite

Updated over 6 years ago

Single container for running Magento integration and unit test suites

Image
0

10K+

magesuite/run-tests repository overview

MageSuite Docker Container For Running Magento Tests

Use stable or -stable suffixed docker tags (are built from vX.Y git tags), others may be unstable.

Please see the docker hub repo page magesuite/run-tests.

Docker tags and software versions

The master branch uses Maria DB 10.2, Elasticsearch 6 and PHP 7.2 which are the latest versions supported by Magento.

Other versions will be avaialble on appropriately named branches / docker tags.

See all tags on Docker Hub.

Tag suffixes

  • -latest - built from branch tip
  • -stable - built from tags named vX.Y

Plain tags

  • latest - master branch tip
  • stable - latest tag named vX.Y

Notable versions

VersionDocker tagPHPDBElasticsearch
php71-es6-mariadb101php71-es6-mariadb101-stable7.1.XMariaDB 10.16.X
php72-es6-mariadb101php72-es6-mariadb101-stable7.2.XMariaDB 10.16.X
php73-es6-mariadb101php73-es6-mariadb101-stable7.3.XMariaDB 10.16.X
php71-es6-mariadb102php71-es6-mariadb102-stable7.1.XMariaDB 10.26.X
php72-es6-mariadb102php72-es6-mariadb102-stable7.2.XMariaDB 10.26.X
php73-es6-mariadb102php73-es6-mariadb102-stable7.3.XMariaDB 10.26.X
php71-es7-mariadb103php71-es7-mariadb103-stable7.1.XMariaDB 10.37.X
php72-es7-mariadb103php72-es7-mariadb103-stable7.2.XMariaDB 10.37.X
php73-es7-mariadb104php73-es7-mariadb104-stable7.3.XMariaDB 10.47.X

Note: The exec mount opt on /tmp is needed for elasticsearch because it maps mem to temp files. The image is big and there's not really a way around it since it has a lot of software and is based on CentOS (which we use for local dev / production deployments, so we want to keep everything else close).

Basic usage

Start the container with all services
docker run \
    --rm \
    --detach \
    --name mgs-test \
    --tmpfs /tmp:rw,exec,mode=1777 \
    --tmpfs /var/lib/mysql:rw,mode=777 \
    --tmpfs /var/lib/elasticsearch:rw,mode=777 \
    --tmpfs /var/www/html/generated:rw,mode=777 \
    --tmpfs /var/www/html/var:rw,mode=777 \
    --tmpfs /var/www/html/dev/tests/integration/tmp:rw,mode=777 \
    --volume "$(pwd):/var/www/html" \
    "magesuite/run-tests:php72-es6-mariadb102-stable"
Wait until healthcheck is green
while [[ "$(docker inspect --format='{{json .State.Health.Status}}' mgs-test)" == '"starting"' ]] ; do sleep 1s && echo "Waiting for start"; done
Then later execute your test suite
docker exec \
    --tty \
    mgs-test \
    /usr/bin/mgs-run-tests ci creativestyle "$(id -u)" "$(id -g)"

Alternatively if the internal UID/GID switch doesn't work for you for some reason you can try switching the docker UID/GID:

docker exec \
    --tty \
    --user "$(id -u):$(id -g)" \
    mgs-test \
    /usr/bin/mgs-run-tests ci creativestyle

During the testing you can get into the bash shell to poke around:

docker exec -it mgs-test /bin/bash

Run everthing at once

As an alternative you could run everything at once as the tests will wait for healthcheck to become green before proceeding:

docker run \
    --tty \
    --tmpfs /tmp:rw,exec,mode=1777 \
    --tmpfs /var/lib/mysql:rw,mode=777 \
    --tmpfs /var/lib/elasticsearch:rw,mode=777 \
    --tmpfs /var/www/html/generated:rw,mode=777 \
    --tmpfs /var/www/html/var:rw,mode=777 \
    --tmpfs /var/www/html/dev/tests/integration/tmp:rw,mode=777 \
    --volume "$(pwd):/var/www/html" \
    "magesuite/run-tests:php72-es6-mariadb102-stable" \
    "/usr/bin/elasticsearch-server" \
    "/usr/bin/mysql-server" \
    "/usr/bin/mgs-run-tests ci creativestyle $(id -u) $(id -g)"

Run a bash shell without starting any services

docker run \
    --tty \
    --interactive \
    --tmpfs /tmp:rw,exec,mode=1777 \
    --tmpfs /var/lib/mysql:rw,mode=777 \
    --tmpfs /var/lib/elasticsearch:rw,mode=777 \
    --tmpfs /var/www/html/generated:rw,mode=777 \
    --tmpfs /var/www/html/var:rw,mode=777 \
    --tmpfs /var/www/html/dev/tests/integration/tmp:rw,mode=777 \
    --volume "$(pwd):/var/www/html" \
    "magesuite/run-tests:php72-es6-mariadb102-stable" \
    "/bin/bash"

You can start the services while inside by doing:

/usr/bin/elasticsearch-server &
/usr/bin/mysql-server &

Tag summary

Content type

Image

Digest

Size

803.8 MB

Last updated

over 6 years ago

docker pull magesuite/run-tests