From 01791a9db526fd4487aebeaf97fec39fbcd12542 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Mon, 4 Feb 2019 09:33:42 +0100 Subject: [PATCH] Add some configuration for the e2e tests --- Dockerfile | 3 +++ bitbucket-pipelines.yml | 4 +++- build-docker-image.sh | 3 +++ docker-bash.sh | 3 +++ setup-for-tests.sh | 7 ++++++- 5 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 build-docker-image.sh create mode 100755 docker-bash.sh diff --git a/Dockerfile b/Dockerfile index e244d67c..92a8c825 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,3 +5,6 @@ RUN pip install pipenv RUN curl -sL https://deb.nodesource.com/setup_8.x | bash RUN apt-get install nodejs -y RUN apt-get install xvfb libgtk2.0-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 -y +RUN apt-get install postgresql postgresql-contrib -y +RUN npm install cypress +RUN /node_modules/.bin/cypress install diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 7757fa53..adfbbb9c 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -37,10 +37,12 @@ aliases: - *setup-tests - npm install --prefix client - npm run "install:cypress" --prefix client + - psl -U $DATABASE_USER -h $DATABASE_HOST -c "create database $DATABASE_NAME" - python server/manage.py dummy_data - python server/manage.py runserver & - npm run dev --prefix client & - - npm run "test:cypress" --prefix client + - cd client + - /node_modules/.bin/cypress run - &deploy-prod name: deploy to prod on Heroku script: diff --git a/build-docker-image.sh b/build-docker-image.sh new file mode 100755 index 00000000..5578e925 --- /dev/null +++ b/build-docker-image.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker build --memory=1g --memory-swap=1g -t iterativ/skillbox-test -f Dockerfile . diff --git a/docker-bash.sh b/docker-bash.sh new file mode 100755 index 00000000..1172ccef --- /dev/null +++ b/docker-bash.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker run -it --volume /home/ramon/dev/django/skillbox:/skillbox --workdir /skillbox --memory 4g --memory-swappiness 0 --entrypoint /bin/bash --link skillboxtestdb:postgres iterativ/skillbox-test:latest diff --git a/setup-for-tests.sh b/setup-for-tests.sh index 784e2072..7c38bf8d 100755 --- a/setup-for-tests.sh +++ b/setup-for-tests.sh @@ -1,6 +1,11 @@ #!/bin/bash export SECRET_KEY=abcd1234 -export DATABASE_URL=postgres://postgres:postgres@localhost:5432/skillbox +export DATABASE_HOST=localhost +export DATABASE_USER=postgres +export PG_PASSWORD=postgres +export DATABASE_NAME=skillbox_test +export DATABASE_PORT=5432 +export DATABASE_URL=postgres://$DATABASE_USER:$PG_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DATABASE_NAME export DEBUG=True export USE_AWS=False pipenv install --dev --system