Add an initial check and gate job configuration for zuul

Updates for running ui tests and linters
This commit is contained in:
Matthew Jones 2018-09-24 10:53:55 -04:00
parent f328f8cad4
commit 3a8bacb8ef
No known key found for this signature in database
GPG Key ID: EED42EEB8B369E1E
6 changed files with 44 additions and 49 deletions

View File

@ -364,7 +364,7 @@ test:
@if [ "$(VENV_BASE)" ]; then \
. $(VENV_BASE)/awx/bin/activate; \
fi; \
py.test -n auto $(TEST_DIRS)
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider -n auto $(TEST_DIRS)
awx-manage check_migrations --dry-run --check -n 'vNNN_missing_migration_file'
test_combined: test_ansible test
@ -564,6 +564,9 @@ docker-compose-cluster: docker-auth
docker-compose-test: docker-auth
cd tools && TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose run --rm --service-ports awx /bin/bash
docker-compose-runtest:
cd tools && TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose run --rm --service-ports awx /start_tests.sh
docker-compose-build: awx-devel-build
# Base development image build

View File

@ -16,7 +16,6 @@ pytest-timeout
pytest-xdist
logutils
flower
uwsgitop
jupyter
matplotlib
backports.tempfile # support in unit tests for py32+ tempfile.TemporaryDirectory

View File

@ -25,6 +25,7 @@ ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info
RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.conf /etc/nginx/nginx.conf
RUN ln -Ffs /awx_devel/tools/docker-compose/nginx.vh.default.conf /etc/nginx/conf.d/nginx.vh.default.conf
RUN ln -s /awx_devel/tools/docker-compose/start_development.sh /start_development.sh
RUN ln -s /awx_devel/tools/docker-compose/start_tests.sh /start_tests.sh
RUN ln -s /awx_devel/tools/docker-compose/bootstrap_development.sh /bootstrap_development.sh
RUN openssl req -nodes -newkey rsa:2048 -keyout /etc/nginx/nginx.key -out /etc/nginx/nginx.csr -subj "/C=US/ST=North Carolina/L=Durham/O=Ansible/OU=AWX Development/CN=awx.localhost"
RUN openssl x509 -req -days 365 -in /etc/nginx/nginx.csr -signkey /etc/nginx/nginx.key -out /etc/nginx/nginx.crt

View File

@ -0,0 +1,9 @@
set +x
cp -R /tmp/awx.egg-info /awx_devel/ || true
sed -i "s/placeholder/$(cat /awx_devel/VERSION)/" /awx_devel/awx.egg-info/PKG-INFO
cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link
cd /awx_devel
cp awx/settings/local_settings.py.docker_compose awx/settings/local_settings.py
make test

View File

@ -2,7 +2,7 @@
# Code duplicated from start_development.sh
cp -R /tmp/awx.egg-info /awx_devel/ || true
sed -i "s/placeholder/$(git describe --long | sed 's/\./\\./g')/" /awx_devel/awx.egg-info/PKG-INFO
sed -i "s/placeholder/$(cat /awx_devel/VERSION)/" /awx_devel/awx.egg-info/PKG-INFO
cp /tmp/awx.egg-link /venv/awx/lib/python2.7/site-packages/awx.egg-link
cp -f awx/settings/local_settings.py.docker_compose awx/settings/local_settings.py

75
tox.ini
View File

@ -5,73 +5,56 @@ envlist =
ui-lint,
api,
ui,
coveralls
[testenv]
basepython = python2.7
setenv =
DJANGO_SETTINGS_MODULE = awx.settings.development_quiet
SWIG_FEATURES = -cpperraswarn -includeall -I/usr/include/openssl
HOME = {homedir}
USERPROFILE = {homedir}
ANSIBLE_VENV_PATH = {toxworkdir}
AWX_VENV_PATH = {toxworkdir}
SKIP_SLOW_TESTS = True
; [testenv]
; basepython = python2.7
; setenv =
; DJANGO_SETTINGS_MODULE = awx.settings.development_quiet
; SWIG_FEATURES = -cpperraswarn -includeall -I/usr/include/openssl
; HOME = {homedir}
; USERPROFILE = {homedir}
; ANSIBLE_VENV_PATH = {toxworkdir}
; AWX_VENV_PATH = {toxworkdir}
; SKIP_SLOW_TESTS = True
[testenv:api-lint]
deps =
-r{toxinidir}/requirements/requirements.txt
-r{toxinidir}/requirements/requirements_dev.txt
coverage
coveralls
commands =
make flake8
flake8
[testenv:ui-lint]
deps =
nodeenv
commands =
make jshint
make ui-devel
npm run --prefix awx/ui jshint
npm run --prefix awx/ui lint
[testenv:api]
deps =
-r{toxinidir}/requirements/requirements.txt
-r{toxinidir}/requirements/requirements_dev.txt
ansible
coverage
coveralls
#-r{toxinidir}/requirements/requirements.txt
#-r{toxinidir}/requirements/requirements_git.txt
#-r{toxinidir}/requirements/requirements_dev.txt
#ansible
#coverage
#coveralls
docker-compose
commands =
python setup.py develop
#python setup.py develop
# coverage run --help
# coverage run -p --source awx/main/tests -m pytest {posargs}
py.test awx/main/tests awx/conf/tests awx/sso/tests {posargs:-k 'not old'}
#py.test -n auto awx/main/tests/unit awx/main/tests/functional awx/conf/tests awx/sso/tests
#awx-manage check_migrations --dry-run --check -n 'vNNN_missing_migration_file'
#make test
make docker-compose-build
make docker-compose-runtest
[testenv:ui]
deps =
nodeenv
commands =
make UI_TEST_MODE=CI test-ui
[testenv:ansible]
deps =
ansible
pytest
-r{toxinidir}/requirements/requirements_ansible.txt
commands =
{envdir}/bin/py.test awx/lib/tests/ -c awx/lib/tests/pytest.ini {posargs}
[testenv:coveralls]
commands=
coverage combine
coverage report -m
coveralls
[pytest]
DJANGO_SETTINGS_MODULE = awx.settings.development
python_paths = venv/tower/lib/python2.7/site-packages
site_dirs = venv/tower/lib/python2.7/site-packages
python_files = *.py
addopts = --reuse-db --nomigrations --tb=native
markers =
ac: access control test
license_feature: ensure license features are accessible or not depending on license
make ui-devel
make ui-test-ci