[ci] Add job to run functional tests over py3 env

Change-Id: Ia9e2d88976f06c20847729ca011e112f9bc53ff8
This commit is contained in:
Andrey Kurilin 2019-02-04 19:09:12 +02:00
parent 78f43cd992
commit 5e2721c8ee
6 changed files with 39 additions and 28 deletions

View File

@ -37,6 +37,16 @@
vars:
tox_env: functional
- job:
name: rally-tox-functional-py3
parent: rally-tox-base
description: |
Run test for rally project.
Uses tox with the ``functional-py3`` environment.
vars:
tox_env: functional-py3
- job:
name: rally-tox-self
parent: rally-tox-base

View File

@ -40,6 +40,7 @@
- rally-tox-py37
- rally-tox-cover
- rally-tox-functional
- rally-tox-functional-py3
- rally-database-migration
- rally-install-ubuntu-xenial
- rally-install-ubuntu-bionic
@ -56,6 +57,7 @@
- rally-tox-py37
- rally-tox-cover
- rally-tox-functional
- rally-tox-functional-py3
- rally-database-migration
- rally-install-ubuntu-xenial
- rally-install-ubuntu-bionic

View File

@ -1,19 +0,0 @@
#!/usr/bin/env bash
LOCAL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DB_CONNECTION="$(rally db show)"
if [[ $DB_CONNECTION == sqlite* ]]; then
CONCURRENCY=0
else
# in case of not sqlite db backends we cannot launch tests in parallel due
# to possible conflicts
CONCURRENCY=1
# currently, RCI_KEEP_DB variable is used to not create new databases per
# each test
export RCI_KEEP_DB=1
fi
python $LOCAL_DIR/pytest_launcher.py "tests/functional" --concurrency $CONCURRENCY --posargs=$1

View File

@ -35,7 +35,7 @@ class EnvTestCase(unittest.TestCase):
self.assertEqual({}, env_data["platforms"])
def _create_spec(self, spec):
f = tempfile.NamedTemporaryFile(delete=False)
f = tempfile.NamedTemporaryFile(mode="w", delete=False)
def unlink():
os.unlink(f.name)

View File

@ -16,18 +16,30 @@
import subprocess
import unittest
import six
from rally.utils import encodeutils
class CLITestCase(unittest.TestCase):
def test_rally_cli(self):
try:
output = subprocess.check_output(["rally"],
stderr=subprocess.STDOUT)
subprocess.check_output(["rally"], stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
output = e.output
self.assertIn("too few arguments", output)
output = encodeutils.safe_decode(e.output)
else:
self.fail("It should ve non-zero exit code.")
# NOTE(andreykurilin): we should have the same errors...
if six.PY2:
self.assertIn("too few arguments", output)
else:
self.assertIn("the following arguments are required: category",
output)
def test_version_cli(self):
output = subprocess.check_output(["rally", "version"],
stderr=subprocess.STDOUT)
output = encodeutils.safe_decode(
subprocess.check_output(["rally", "version"],
stderr=subprocess.STDOUT))
self.assertIn("Rally version:", output)

10
tox.ini
View File

@ -67,10 +67,16 @@ commands =
echo "do nothing"
[testenv:functional]
sitepackages = True
basepython = python2.7
commands =
find . -type f -name "*.pyc" -delete
{toxinidir}/tests/ci/rally_functional_job.sh {posargs}
python {toxinidir}/tests/ci/pytest_launcher.py tests/functional --posargs={posargs}
[testenv:functional-py3]
basepython = python3
commands =
find . -type f -name "*.pyc" -delete
python {toxinidir}/tests/ci/pytest_launcher.py tests/functional --posargs={posargs}
[testenv:cover]
commands = {toxinidir}/tests/ci/cover.sh {posargs}