Changes to enable tests in k8s

This commit is contained in:
Shane McDonald 2019-05-21 19:15:21 -04:00
parent 5a502f8709
commit 2f77c67a62
5 changed files with 29 additions and 107 deletions

View File

@ -346,6 +346,7 @@ pylint: reports
genschema: reports
$(MAKE) swagger PYTEST_ARGS="--genschema"
mv swagger.json schema.json
swagger: reports
@if [ "$(VENV_BASE)" ]; then \
@ -496,6 +497,10 @@ ui-devel: $(UI_DEPS_FLAG_FILE)
ui-test: $(UI_DEPS_FLAG_FILE)
$(NPM_BIN) --prefix awx/ui run test
ui-lint: $(UI_DEPS_FLAG_FILE)
$(NPM_BIN) run --prefix awx/ui jshint
$(NPM_BIN) run --prefix awx/ui lint
# A standard go-to target for API developers to use building the frontend
ui: clean-ui ui-devel
@ -572,12 +577,7 @@ docker-compose-runtest:
docker-compose-build-swagger:
cd tools && CURRENT_UID=$(shell id -u) TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose run --rm --service-ports awx /start_tests.sh swagger
docker-compose-genschema:
cd tools && CURRENT_UID=$(shell id -u) TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose run --rm --service-ports awx /start_tests.sh genschema
mv swagger.json schema.json
docker-compose-detect-schema-change:
$(MAKE) docker-compose-genschema
detect-schema-change: genschema
curl https://s3.amazonaws.com/awx-public-ci-files/schema.json -o reference-schema.json
# Ignore differences in whitespace with -b
diff -u -b reference-schema.json schema.json

View File

@ -386,16 +386,6 @@ def test_saml_x509cert_validation(patch, get, admin, headers):
assert resp.status_code == 200
@pytest.mark.django_db
def test_default_broker_url():
url = parse_url(settings.BROKER_URL)
assert url['transport'] == 'amqp'
assert url['hostname'] == 'rabbitmq'
assert url['userid'] == 'guest'
assert url['password'] == 'guest'
assert url['virtual_host'] == '/'
@pytest.mark.django_db
def test_broker_url_with_special_characters():
settings.BROKER_URL = 'amqp://guest:a@ns:ibl3#@rabbitmq:5672//'

View File

@ -6,14 +6,20 @@ RUN yum -y update && yum -y install epel-release
# sync with installer/roles/image_build/templates/Dockerfile.j2
RUN yum -y install acl \
alsa-lib \
ansible \
atk \
bubblewrap \
cups-libs \
curl \
cyrus-sasl \
cyrus-sasl-devel \
gcc \
gcc-c++ \
GConf2 \
git \
gtk3 \
ipa-gothic-fonts \
krb5-devel \
krb5-libs \
krb5-workstation \
@ -22,8 +28,16 @@ RUN yum -y install acl \
libselinux-python \
libstdc++.so.6 \
libtool-ltdl-devel \
libXcomposite \
libXcursor \
libXdamage \
libXext \
libXi \
libxml2-devel \
libXrandr \
libXScrnSaver \
libxslt-devel \
libXtst \
make \
mercurial \
mg \
@ -34,7 +48,6 @@ RUN yum -y install acl \
postgresql-devel \
python-devel \
python-pip \
python-pip \
python-psutil \
python-psycopg2 \
python-setuptools \
@ -52,6 +65,12 @@ RUN yum -y install acl \
xmlsec1-devel \
xmlsec1-openssl \
xmlsec1-openssl-devel \
xorg-x11-fonts-100dpi \
xorg-x11-fonts-75dpi \
xorg-x11-fonts-cyrillic \
xorg-x11-fonts-misc \
xorg-x11-fonts-Type1 \
xorg-x11-utils \
yum-utils
ADD https://github.com/krallin/tini/releases/download/v0.14.0/tini /tini
@ -67,7 +86,7 @@ ADD tools/docker-compose/awx.egg-info /tmp/awx.egg-info
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
RUN python3 -m ensurepip && pip3 install virtualenv
RUN python3 -m ensurepip && pip3 install virtualenv flake8
RUN pip install supervisor
ADD Makefile /tmp/Makefile
@ -86,7 +105,6 @@ RUN cd /tmp && VENV_BASE="/venv" make requirements_dev
# Use the distro provided npm to bootstrap our required version of node
RUN npm install -g n
RUN n 8.15.0
ENV PATH /usr/bin:/usr/local/n/versions/node/8.15.0/bin:$PATH
RUN yum -y remove cyrus-sasl-devel \
gcc \
@ -131,3 +149,5 @@ RUN for dir in /var/lib/awx/ /var/log/tower/ /projects /.ansible /var/log/nginx
RUN for file in /etc/passwd /etc/supervisord.conf \
/venv/awx/lib/python3.6/site-packages/awx.egg-link /var/run/nginx.pid; \
do touch $file; chmod -R g+rwx $file; chgrp -R root $file; done
ENV PATH=/usr/local/n/versions/node/8.15.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

View File

@ -1,12 +1,6 @@
#!/bin/bash
set +x
if [ `id -u` -ge 500 ] || [ -z "${CURRENT_UID}" ]; then
echo "awx:x:`id -u`:`id -g`:,,,:/tmp:/bin/bash" >> /tmp/passwd
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
fi
cd /awx_devel
make clean
cp -R /tmp/awx.egg-info /awx_devel/ || true

82
tox.ini
View File

@ -1,82 +0,0 @@
[tox]
skipsdist = true
envlist =
api-lint,
ui-lint,
api,
ui,
swagger,
detect-schema-change,
[testenv]
;basepython = python2.7
whitelist_externals = make
; 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]
basepython = python3.6
deps =
-r{toxinidir}/requirements/requirements_dev.txt
coverage
coveralls
commands =
flake8
[testenv:ui-lint]
deps =
nodeenv
commands =
make clean-ui
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_git.txt
#-r{toxinidir}/requirements/requirements_dev.txt
#ansible
#coverage
#coveralls
; https://github.com/docker/compose/issues/6311
docker-compose<1.23.0
commands =
#python setup.py develop
# coverage run --help
# coverage run -p --source awx/main/tests -m pytest {posargs}
#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 clean-ui
make ui-devel
make ui-test-ci
[testenv:swagger]
deps =
nodeenv
commands =
make docker-compose-build
make docker-compose-build-swagger
[testenv:detect-schema-change]
deps =
nodeenv
commands =
make docker-compose-build
make docker-compose-detect-schema-change