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

View File

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

View File

@ -28,9 +28,7 @@
"test": "npm-run-all test:*", "test": "npm-run-all test:*",
"test:backend": "nyc mocha --reporter=min test/backend", "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: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-compose up --abort-on-container-exit --exit-code-from integration-tests --build --remove-orphans --quiet-pull && docker-compose down --rmi local",
"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 &",
"start": "npm run clean && cross-env NODE_ENV=development webpack-dev-server", "start": "npm run clean && cross-env NODE_ENV=development webpack-dev-server",
"prod": "node server/prod.js" "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 skipsdist = True
[testenv] [testenv]
recreate=True
skip_install = True skip_install = True
passenv = DISPLAY MOZ_HEADLESS
deps = -rpipenv.txt deps = -rpipenv.txt
commands = commands =
pipenv install --skip-lock 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] [testenv:flake8]
commands = commands =
@ -20,5 +18,5 @@ commands =
exclude = .eggs,.tox,docs,node_modules exclude = .eggs,.tox,docs,node_modules
[pytest] [pytest]
base_url = http://localhost:8080 base_url = http://web:1443
sensitive_url = mozilla\.(com|org) sensitive_url = mozilla\.(com|org)