diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e9deef69 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.5 +RUN apt-get update +RUN apt-get install -y make python-software-properties curl +RUN curl -sL https://deb.nodesource.com/setup_7.x | bash - +RUN apt-get update +RUN apt-get install -y nodejs +RUN pip install -U setuptools +RUN pip install coveralls bandit +WORKDIR /app +COPY . /app/ +RUN pip install -e . +RUN pip install "file://`pwd`#egg=lemur[dev]" +RUN pip install "file://`pwd`#egg=lemur[tests]" diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..35c52b73 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +--- +version: '2.0' +services: + test: + build: . + volumes: + - ".:/app" + links: + - postgres + command: make test + environment: + SQLALCHEMY_DATABASE_URI: postgresql://lemur:lemur@postgres:5432/lemur + + postgres: + image: postgres:9.4 + environment: + POSTGRES_USER: lemur + POSTGRES_PASSWORD: lemur diff --git a/docs/developer/index.rst b/docs/developer/index.rst index bd43d8ca..79e2fc74 100644 --- a/docs/developer/index.rst +++ b/docs/developer/index.rst @@ -89,6 +89,12 @@ You'll likely want to make some changes to the default configuration (we recomme .. note:: The ``upgrade`` shortcut is simply a shortcut to Alembic's upgrade command. +Running tests with Docker and docker-compose +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Alternatively you can use Docker and docker-compose for running the tests with ``docker-compose run test``. + + Coding Standards ---------------- diff --git a/lemur/tests/conf.py b/lemur/tests/conf.py index d29265f4..ac5d524e 100644 --- a/lemur/tests/conf.py +++ b/lemur/tests/conf.py @@ -49,7 +49,7 @@ LEMUR_ALLOW_WEEKEND_EXPIRATION = False # Database # modify this if you are not using a local database -SQLALCHEMY_DATABASE_URI = 'postgresql://lemur:lemur@localhost:5432/lemur' +SQLALCHEMY_DATABASE_URI = os.getenv('SQLALCHEMY_DATABASE_URI', 'postgresql://lemur:lemur@localhost:5432/lemur') SQLALCHEMY_TRACK_MODIFICATIONS = False # AWS