Add Makefile targets to run all or selected tests against a
MySQL or Postgres Docker container. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
29
Makefile
29
Makefile
@@ -68,6 +68,29 @@ test:
|
||||
test-all:
|
||||
./manage.py test --mayan-apps --settings=mayan.settings.testing --nomigrations
|
||||
|
||||
test-launch-postgres:
|
||||
@docker rm -f test-postgres || true
|
||||
docker run -d --name test-postgres -p 5432:5432 postgres
|
||||
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
||||
sleep 2
|
||||
|
||||
test-postgres: test-launch-postgres
|
||||
./manage.py test $(MODULE) --settings=mayan.settings.testing.docker.db_postgres --nomigrations
|
||||
|
||||
test-postgres-all: test-launch-postgres
|
||||
./manage.py test --mayan-apps --settings=mayan.settings.testing.docker.db_postgres --nomigrations
|
||||
|
||||
test-launch-mysql:
|
||||
@docker rm -f test-mysql || true
|
||||
docker run -d --name test-mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan mysql
|
||||
while ! nc -z 127.0.0.1 3306; do sleep 1; done
|
||||
sleep 10
|
||||
|
||||
test-mysql: test-launch-mysql
|
||||
./manage.py test $(MODULE) --settings=mayan.settings.testing.docker.db_mysql --nomigrations
|
||||
|
||||
test-mysql-all: test-launch-mysql
|
||||
./manage.py test --mayan-apps --settings=mayan.settings.testing.docker.db_mysql --nomigrations
|
||||
|
||||
# Documentation
|
||||
|
||||
@@ -197,17 +220,17 @@ docker_services_on:
|
||||
while ! nc -z 127.0.0.1 6379; do sleep 1; done
|
||||
while ! nc -z 127.0.0.1 5432; do sleep 1; done
|
||||
sleep 2
|
||||
./manage.py initialsetup --settings=mayan.settings.testing.docker
|
||||
./manage.py initialsetup --settings=mayan.settings.staging.docker
|
||||
|
||||
docker_services_off:
|
||||
docker stop postgres redis
|
||||
docker rm postgres redis
|
||||
|
||||
docker_services_frontend:
|
||||
./manage.py runserver --settings=mayan.settings.testing.docker
|
||||
./manage.py runserver --settings=mayan.settings.staging.docker
|
||||
|
||||
docker_services_worker:
|
||||
./manage.py celery worker --settings=mayan.settings.testing.docker -B -l INFO -O fair
|
||||
./manage.py celery worker --settings=mayan.settings.staging.docker -B -l INFO -O fair
|
||||
|
||||
docker_service_mysql_on:
|
||||
docker run -d --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan_edms mysql
|
||||
|
||||
1
mayan/settings/staging/__init__.py
Normal file
1
mayan/settings/staging/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .base import * # NOQA
|
||||
1
mayan/settings/testing/docker/__init__.py
Normal file
1
mayan/settings/testing/docker/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .base import * # NOQA
|
||||
6
mayan/settings/testing/docker/base.py
Normal file
6
mayan/settings/testing/docker/base.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from ..base import * # NOQA
|
||||
|
||||
SIGNATURES_GPG_PATH = '/usr/bin/gpg1'
|
||||
|
||||
13
mayan/settings/testing/docker/db_mysql.py
Normal file
13
mayan/settings/testing/docker/db_mysql.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from .base import * # NOQA
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'mayan',
|
||||
'USER': 'root',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
}
|
||||
}
|
||||
13
mayan/settings/testing/docker/db_postgres.py
Normal file
13
mayan/settings/testing/docker/db_postgres.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .base import * # NOQA
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 'postgres',
|
||||
'USER': 'postgres',
|
||||
'HOST': 'localhost',
|
||||
'PORT': '5432',
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user