From 22cae87c4343aa90084dc690632f81cb4d1187e0 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 26 Apr 2019 10:40:07 -0500 Subject: [PATCH] test nova proxy tests Change-Id: Ic68e4d88f2e063ab63fb3f8429dc5430e966109e Signed-off-by: Dean Troyer --- .zuul.yaml | 16 +++++++ playbooks/fetch-staging/pre.yaml | 13 ++++++ tox.ini | 74 ++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 playbooks/fetch-staging/pre.yaml create mode 100644 tox.ini diff --git a/.zuul.yaml b/.zuul.yaml index e7c200a..324233b 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,19 @@ - project: templates: - noop-jobs + check: + jobs: + - stx-stein-nova-functional + +- job: + name: stx-stein-nova-functional + parent: nova-tox-functional + required-projects: + # - name: github.com/starlingx-staging/stx-nova + # override-checkout: stx/stein.1 + - name: openstack/placement + - name: openstack/nova + vars: + tox_envlist: pep8 + tox_install_siblings: true + pre-run: playbooks/fetch-staging/pre.yaml diff --git a/playbooks/fetch-staging/pre.yaml b/playbooks/fetch-staging/pre.yaml new file mode 100644 index 0000000..745208d --- /dev/null +++ b/playbooks/fetch-staging/pre.yaml @@ -0,0 +1,13 @@ +- hosts: all + pre_tasks: + - name: Determine if repo directory exists already + stat: + path: "src/stx" + register: stx_exists + + - name: Clone stx-nova repo + git: + repo: https://github.com/starlingx-staging/stx-nova.git + dest: "src/stx" + version: stx/stein.1 + when: stx_exists.stat.isdir is undefined diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..c2540b2 --- /dev/null +++ b/tox.ini @@ -0,0 +1,74 @@ +[tox] +minversion = 3.1.1 + +[testenv] +basepython = python3 +usedevelop = True +whitelist_externals = + bash + find + rm + env + ls +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/stein} {opts} {packages} +setenv = + VIRTUAL_ENV={envdir} + LANGUAGE=en_US + LC_ALL=en_US.utf-8 + OS_STDOUT_CAPTURE=1 + OS_STDERR_CAPTURE=1 + OS_TEST_TIMEOUT=160 + PYTHONDONTWRITEBYTECODE=1 +# TODO(stephenfin): Remove psycopg2 when minimum constraints is bumped to 2.8 + PYTHONWARNINGS = ignore::UserWarning:psycopg2 +deps = -r{toxinidir}/test-requirements.txt +passenv = + OS_DEBUG GENERATE_HASHES +# there is also secret magic in subunit-trace which lets you run in a fail only +# mode. To do this define the TRACE_FAILONLY environmental variable. + +[testenv:pep8] +description = + Run style checks. +envdir = {toxworkdir}/shared +commands = + bash tools/flake8wrap.sh {posargs} + # Check that all JSON files don't have \r\n in line. + bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'" + # Check that all included JSON files are valid JSON + bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python' + +[testenv:functional] +# TODO(melwitt): This can be removed when functional tests are gating with +# python 3.x +# NOTE(cdent): For a while, we shared functional virtualenvs with the unit +# tests, to save some time. However, this conflicts with tox siblings in zuul, +# and we need siblings to make testing against master of other projects work. +basepython = python2.7 +setenv = {[testenv]setenv} +# As nova functional tests import the PlacementFixture from the placement +# repository these tests are, by default, set up to run with latest master from +# the placement repo. In the gate, Zuul will clone the latest master from +# placement OR the version of placement the Depends-On in the commit message +# suggests. If you want to run the test locally with an un-merged placement +# change, modify this line locally to point to your dependency or pip install +# placement into the appropriate tox virtualenv. We express the requirement +# here instead of test-requirements because we do not want placement present +# during unit tests. +deps = + -r{toxinidir}/test-requirements.txt + git+https://git.openstack.org/openstack/placement#egg=openstack-placement +commands = +# NOTE(cdent): The group_regex describes how stestr will group tests into the +# same process when running concurently. The following ensures that gabbi tests +# coming from the same YAML file are all in the same process. This is important +# because each YAML file represents an ordered sequence of HTTP requests. Note +# that tests which do not match this regex will not be grouped in any +# special way. See the following for more details. +# http://stestr.readthedocs.io/en/latest/MANUAL.html#grouping-tests +# https://gabbi.readthedocs.io/en/latest/#purpose + ls -l ../.. + ls -l .. + bash -c "cd ../../github.com/starlingx-staging/stx-nova; git branch" + stestr --test-path=./nova/tests/functional --group_regex=nova\.tests\.functional\.api\.openstack\.placement\.test_placement_api(?:\.|_)([^_]+) run {posargs} +# stestr slowest