freeipa/.travis.yml
Stanislav Levin 2312b38a67 Simplify ipa-run-tests script
This is a sort of rollback to the pre #93c158b05 state with
several improvements.

For now, the nodeids calculation by ipa-run-tests is not stable,
since it depends on current working directory. Nodeids (tests
addresses) are utilized by the other plugins, for example.

Unfortunately, the `pytest_load_initial_conftests` hook doesn't
correctly work with pytest internal paths, since it is called
after the calculation of rootdir was performed, for example.

Eventually, it's simpler to follow the default convention for
Python test discovery.

There is at least one drawback of new "old" implementation.
The ignore rules don't support globs, because pytest 4.3.0+
has the same facility via `--ignore-glob`:

> Add the `--ignore-glob` parameter to exclude test-modules with
> Unix shell-style wildcards. Add the collect_ignore_glob for
> conftest.py to exclude test-modules with Unix shell-style
> wildcards.

Upon switching to pytest4 it will be possible to utilize this.
Anyway, tests for checking current basic facilities of
ipa-run-tests were added.

Fixes: https://pagure.io/freeipa/issue/8007
Signed-off-by: Stanislav Levin <slev@altlinux.org>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2019-07-16 13:23:21 +03:00

80 lines
2.6 KiB
YAML

# workaround for missing IPv6 address support
# https://github.com/travis-ci/travis-ci/issues/8891
sudo: required
dist: trusty
group: deprecated-2017Q4
language: python
services:
- docker
python:
- "3.6"
cache: pip
env:
global:
- TEST_RUNNER_IMAGE="freeipa/freeipa-test-runner:master-latest"
PEP8_ERROR_LOG="pycodestyle_errors.log"
CI_RESULTS_LOG="ci_results_${TRAVIS_BRANCH}.log"
CI_BACKLOG_SIZE=5000
CI_RUNNER_LOGS_DIR="/tmp/test-runner-logs"
CI_RUNNER_LOG_ARCHIVE="freeipa-ci-pr-${TRAVIS_PULL_REQUEST}-job-${TRAVIS_JOB_NUMBER}.tar.gz"
matrix:
- TASK_TO_RUN="lint"
TEST_RUNNER_CONFIG=".test_runner_config.yaml"
- TASK_TO_RUN="webui-unit"
TEST_RUNNER_CONFIG=".test_runner_config.yaml"
- TASK_TO_RUN="run-tests"
PYTHON=/usr/bin/python3
TEST_RUNNER_CONFIG=".test_runner_config.yaml"
TESTS_TO_RUN="test_xmlrpc/test_[a-k]*.py"
- TASK_TO_RUN="run-tests"
PYTHON=/usr/bin/python3
TEST_RUNNER_CONFIG=".test_runner_config.yaml"
TESTS_TO_RUN="test_cmdline
test_install
test_ipaclient
test_ipalib
test_ipaplatform
test_ipapython
test_ipaserver
test_ipatests_plugins
test_xmlrpc/test_[l-z]*.py"
- TASK_TO_RUN="tox"
TEST_RUNNER_CONFIG=".test_runner_config.yaml"
before_install:
- ip addr show
- ls /proc/net
- cat /proc/net/if_inet6
# - ip addr show dev lo | grep -q inet6 || (echo "No IPv6 address found"; exit 1)
install:
- pip3 install --upgrade pip
- pip3 install pycodestyle
- >
pip3 install
git+https://github.com/freeipa/ipa-docker-test-runner@release-0-3-1
script:
- mkdir -p $CI_RUNNER_LOGS_DIR
- travis_wait 50 ./.travis_run_task.sh
- test -z "`cat $PEP8_ERROR_LOG`"
after_failure:
- echo "Test runner output:"; tail -n $CI_BACKLOG_SIZE $CI_RESULTS_LOG
- echo "PEP-8 errors:"; cat $PEP8_ERROR_LOG
- >
echo "Archiving CI logs";
if [[ "$TASK_TO_RUN" != "lint" ]]; then
tar --ignore-failed-read -uvf var_log.tar $CI_RESULTS_LOG $PEP8_ERROR_LOG;
gzip var_log.tar;
mv var_log.tar.gz $CI_RUNNER_LOG_ARCHIVE;
transfer_url=$(
curl --upload-file \
./$CI_RUNNER_LOG_ARCHIVE \
https://transfer.sh/${CI_RUNNER_LOG_ARCHIVE}) &&
echo "Download log archive from ${transfer_url}" ||
echo "Failed to upload log archive!";
fi