1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-10 05:02:45 +01:00

moved integration text execution to docker

This commit is contained in:
Danny Coates 2018-05-03 15:00:34 -07:00
parent f36ac24ac5
commit 7d62a23b36
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
6 changed files with 35 additions and 48 deletions

View File

@ -16,7 +16,7 @@ jobs:
- persist_to_workspace:
root: .
paths:
- ./*
- ./dist
test:
docker:
- image: circleci/node:8-browsers
@ -35,14 +35,11 @@ jobs:
- store_artifacts:
path: coverage
integration_tests:
working_directory: ~/send
machine: true
steps:
- checkout
- restore_cache:
keys:
- uitest-cache-{{ checksum "test/integration/Pipfile" }}
- uitest-cache-{{ checksum "test/integration/pipenv.txt" }}
- attach_workspace:
at: .
- run:
name: Install Docker Compose
command: |
@ -50,33 +47,11 @@ jobs:
pip install docker-compose>=1.18
docker-compose --version
- run:
name: Install Tox
command: |
set -x
pip install tox
- run:
name: Start docker container
command: docker-compose up -d
- run:
name: Run User Integration Tests
command: |
npm run start:integration-docker
npm run test-integration-docker
environment:
MOZ_HEADLESS: 1
- store_artifacts:
path: send-test.html
- save_cache:
key: uitest-cache-{{ checksum "test/integration/Pipfile" }}
paths:
- test/integration/.tox
- save_cache:
key: uitest-cache-{{ checksum "test/integration/pipenv.txt" }}
paths:
- test/integration/.tox
command: npm run test-integration
deploy_dev:
machine: true
steps:
- checkout
- attach_workspace:
at: .
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
@ -85,6 +60,7 @@ jobs:
deploy_stage:
machine: true
steps:
- checkout
- attach_workspace:
at: .
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
@ -94,11 +70,20 @@ workflows:
version: 2
test_pr:
jobs:
- build:
filters:
branches:
ignore: master
- test:
filters:
branches:
ignore: master
- integration_tests
- integration_tests:
filters:
branches:
ignore: master
requires:
- build
build_and_deploy_dev:
jobs:
- build:

View File

@ -12,14 +12,15 @@ services:
image: redis:alpine
ports:
- "6379:6379"
selenium-firefox:
selenium:
image: b4handjr/selenium-firefox
volumes:
- .:/send
working_dir: /send
expose:
- "4444"
ports:
- "5900"
- "4444:4444"
shm_size: 2g
integration-tests:
build: ./test/integration
links:
- web
- selenium

View File

@ -28,9 +28,7 @@
"test": "npm-run-all test:*",
"test:backend": "nyc mocha --reporter=min test/backend",
"test:frontend": "cross-env NODE_ENV=development node test/frontend/runner.js && nyc report --reporter=html",
"test-integration-local": "tox -c test/integration/tox.ini",
"test-integration-docker": "docker-compose exec -T --user root selenium-firefox tox -c test/integration/tox.ini",
"start:integration-docker": "docker-compose exec -T --user root selenium-firefox ./test/integration/scripts/start-docker.sh &",
"test-integration": "docker-compose up --abort-on-container-exit --exit-code-from integration-tests --build --remove-orphans --quiet-pull && docker-compose down --rmi local",
"start": "npm run clean && cross-env NODE_ENV=development webpack-dev-server",
"prod": "node server/prod.js"
},

View File

@ -0,0 +1,9 @@
FROM ubuntu:xenial
RUN apt-get update && \
apt-get install -y python-pip python-dev && \
pip install tox
COPY . /integration
WORKDIR /integration
CMD ["tox", "-e", "integration-tests"]

View File

@ -1,4 +0,0 @@
#!/bin/bash
# piping to dev/null for starting the server within the firefox docker image
npm install > "/dev/null" 2>&1
npm start > "/dev/null" 2>&1 &

View File

@ -3,13 +3,11 @@ envlist = integration-tests, flake8
skipsdist = True
[testenv]
recreate=True
skip_install = True
passenv = DISPLAY MOZ_HEADLESS
deps = -rpipenv.txt
commands =
pipenv install --skip-lock
pipenv run pytest -v --verify-base-url -n 2 --driver Firefox --html=send-test.html --self-contained-html {posargs}
pipenv run pytest -v --verify-base-url --driver Remote --capability browserName firefox --host selenium --html=send-test.html --self-contained-html {posargs}
[testenv:flake8]
commands =
@ -20,5 +18,5 @@ commands =
exclude = .eggs,.tox,docs,node_modules
[pytest]
base_url = http://localhost:8080
base_url = http://web:1443
sensitive_url = mozilla\.(com|org)