diff --git a/Makefile b/Makefile index 518d859611..6da9873720 100644 --- a/Makefile +++ b/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 diff --git a/mayan/settings/staging/__init__.py b/mayan/settings/staging/__init__.py new file mode 100644 index 0000000000..530d26cce6 --- /dev/null +++ b/mayan/settings/staging/__init__.py @@ -0,0 +1 @@ +from .base import * # NOQA diff --git a/mayan/settings/testing/docker/__init__.py b/mayan/settings/testing/docker/__init__.py new file mode 100644 index 0000000000..530d26cce6 --- /dev/null +++ b/mayan/settings/testing/docker/__init__.py @@ -0,0 +1 @@ +from .base import * # NOQA diff --git a/mayan/settings/testing/docker/base.py b/mayan/settings/testing/docker/base.py new file mode 100644 index 0000000000..738748eb99 --- /dev/null +++ b/mayan/settings/testing/docker/base.py @@ -0,0 +1,6 @@ +from __future__ import unicode_literals + +from ..base import * # NOQA + +SIGNATURES_GPG_PATH = '/usr/bin/gpg1' + diff --git a/mayan/settings/testing/docker/db_mysql.py b/mayan/settings/testing/docker/db_mysql.py new file mode 100644 index 0000000000..86ffc07bfb --- /dev/null +++ b/mayan/settings/testing/docker/db_mysql.py @@ -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', + } +} diff --git a/mayan/settings/testing/docker/db_postgres.py b/mayan/settings/testing/docker/db_postgres.py new file mode 100644 index 0000000000..b80a29a90a --- /dev/null +++ b/mayan/settings/testing/docker/db_postgres.py @@ -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', + } +}