|
| 1 | +#!/usr/bin/env bash |
| 2 | +# coding=utf-8 |
| 3 | +set -veuo pipefail |
| 4 | + |
| 5 | +# check the commit message |
| 6 | +# ./.travis/check_commit.sh |
| 7 | + |
| 8 | +# Lint code. |
| 9 | +# flake8 --config flake8.cfg || exit 1 |
| 10 | + |
| 11 | +# Run migrations. |
| 12 | +export DJANGO_SETTINGS_MODULE=pulpcore.app.settings |
| 13 | +export PULP_CONTENT_HOST=localhost:24816 |
| 14 | +export PULP3_HOST=localhost:24817 |
| 15 | +pulp-manager makemigrations file --noinput |
| 16 | +pulp-manager migrate --noinput |
| 17 | + |
| 18 | +# Run unit tests. |
| 19 | +# (cd ../pulpcore && coverage run manage.py test pulp_certguard.tests.unit) |
| 20 | + |
| 21 | +# Run functional tests. |
| 22 | +export DJANGO_SETTINGS_MODULE=pulpcore.app.settings |
| 23 | +pulp-manager reset-admin-password --password admin |
| 24 | +pulp-manager runserver 24817 >> ~/django_runserver.log 2>&1 & |
| 25 | +gunicorn pulpcore.content:server --bind 'localhost:24816' --worker-class 'aiohttp.GunicornWebWorker' -w 2 >> ~/content_app.log 2>&1 & |
| 26 | +rq worker -n 'resource-manager@%h' -w 'pulpcore.tasking.worker.PulpWorker' >> ~/resource_manager.log 2>&1 & |
| 27 | +rq worker -n 'reserved-resource-worker_1@%h' -w 'pulpcore.tasking.worker.PulpWorker' >> ~/reserved_worker-1.log 2>&1 & |
| 28 | +sleep 8 |
| 29 | + |
| 30 | +show_logs_and_return_non_zero() { |
| 31 | + readonly local rc="$?" |
| 32 | + cat ~/django_runserver.log |
| 33 | + cat ~/content_app.log |
| 34 | + cat ~/resource_manager.log |
| 35 | + cat ~/reserved_worker-1.log |
| 36 | + return "${rc}" |
| 37 | +} |
| 38 | + |
| 39 | +sudo ./generate.sh python 3.0.0rc1 |
| 40 | + |
| 41 | +# Travis' scripts use unbound variables. This is problematic, because the |
| 42 | +# changes made to this script's environment appear to persist when Travis' |
| 43 | +# scripts execute. Perhaps this script is sourced by Travis? Regardless of why, |
| 44 | +# we need to reset the environment when this script finishes. |
| 45 | +# |
| 46 | +# We can't use `trap cleanup_function EXIT` or similar, because this script is |
| 47 | +# apparently sourced, and such a trap won't execute until the (buggy!) calling |
| 48 | +# script finishes. |
| 49 | +set +euo pipefail |
0 commit comments