Updates to the containerized contract tests setup

This commit is contained in:
Chris Hartjes 2020-04-21 11:42:49 -04:00
Родитель 8449e45a69
Коммит 66dedde5b8
3 изменённых файлов: 5 добавлений и 67 удалений

Просмотреть файл

@ -196,68 +196,7 @@ jobs:
- store_artifacts:
path: test-reports
contract-tests:
docker:
- image: circleci/python:3.7-node-browsers
- image: circleci/postgres:9.6
environment:
POSTGRES_USER: postgres
POSTGRES_DB: normandy
POSTGRES_HOST_AUTH_METHOD: trust
environment:
DJANGO_SETTINGS_MODULE: normandy.settings
DJANGO_CONFIGURATION: ProductionInsecure
# Silence checks about missing geoip, and also the standard silenced warnings from ProductionInsecure in settings.py
DJANGO_SILENCED_SYSTEM_CHECKS: "normandy.recipes.E006,security.W001,security.W003,security.W004,security.W008,security.W009,security.W012,security.W016"
steps:
- checkout
- run:
name: Create virtualenv
command: |
python3 -m venv ~/venv
echo "source ~/venv/bin/activate" >> $BASH_ENV
- run:
name: Install python dependencies
command: poetry install --no-dev --no-interaction --verbose
- run:
name: Install node dependencies
command: yarn install --frozen-lockfile
- run:
name: Create version.json
command: |
printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \
"$CIRCLE_SHA1" \
"${CIRCLE_TAG-}" \
"$CIRCLE_PROJECT_USERNAME" \
"$CIRCLE_PROJECT_REPONAME" \
"$CIRCLE_BUILD_URL" \
> version.json
- run:
name: Prepare DB
command: |
./manage.py migrate
./manage.py update_actions
- run:
name: Starting server
command: gunicorn normandy.wsgi:application --bind localhost:8000
background: true
- run:
name: Waiting for web server to be available
command: |
./ci/wait-for-it.sh localhost:8000 \
--timeout=30 --strict \
-- echo "Done waiting. It should work now."
- run:
name: Contract tests
command: |
mkdir test-reports
py.test contract-tests/v1_api/ \
--tb=short -vvv \
--junitxml=test-reports/junit.xml \
--server http://localhost:8000
containerized-tests:
contract_tests:
machine:
docker_layer_caching: true
steps:
@ -276,7 +215,7 @@ jobs:
- checkout
- run:
name: Run contract tests in containers
command: make containerized_tests
command: make contract_tests
workflows:
version: 2

Просмотреть файл

@ -75,5 +75,5 @@ generate_deploy_bug: build
create_superuser:
docker-compose run app sh -c "/app/bin/wait-for-it.sh db:5432 -- python manage.py createsuperuser --noinput --email=test-user@example.com --user=testuser"
containerized_tests: refresh create_superuser
contract_tests: refresh create_superuser
docker-compose run test sh -c "/app/bin/wait-for-it.sh db:5432 -- pytest contract-tests/ --server https://app:8000"

Просмотреть файл

@ -25,7 +25,7 @@ services:
build:
context: ./
dockerfile: ./Dockerfile.development
command: bash -c "/app/bin/wait-for-it.sh db:5432 -- ./bin/download_geolite2.sh;./bin/runsslserver.sh 0.0.0.0:8000"
command: bash -c "/app/bin/wait-for-it.sh db:5432 -- ./bin/download_geolite2.sh;./bin/runsslserver.sh 0.0.0.0:8123"
links:
- app
networks:
@ -38,7 +38,7 @@ services:
environment:
- DATABASE_URL=postgres://postgres:postgres@db/normandy
ports:
- "8000:8000"
- "8123:8123"
db:
restart: always
@ -58,7 +58,6 @@ volumes:
node_modules_volume:
ssl_volume:
networks:
private_nw:
internal: true