Modify integration tests job to run on DevStack

Change-Id: I5ae22b3a02bd67534c8acb73c968b36f20008b31
This commit is contained in:
Ilya Shakhat 2018-11-26 19:22:19 +04:00
parent 62b96dd2a4
commit 037a321506
6 changed files with 59 additions and 45 deletions

View File

@ -7,29 +7,19 @@
rtd_webhook_id: '47124'
check:
jobs:
- os-faults-integration-py27
- os-faults-integration-py35
- os-faults-devstack
gate:
jobs:
- os-faults-integration-py27
- os-faults-integration-py35
- os-faults-devstack
- job:
name: os-faults-integration-py27
parent: openstack-tox
name: os-faults-devstack
parent: devstack-minimal
description: |
Run integration tests under Python 2.7
To run tests manually use ``tox -e integration-py27`` command.
Run os-faults integration tests on DevStack under Python 3
timeout: 2400
run: os_faults/tests/devstack/playbooks/run_on_devstack.yml
required-projects:
- openstack/os-faults
vars:
tox_envlist: integration-py27
- job:
name: os-faults-integration-py35
parent: openstack-tox
description: |
Run integration tests under Python 3.5
To run tests manually use ``tox -e integration-py35`` command.
vars:
tox_envlist: integration-py35
tox_envlist: devstack

View File

@ -10,3 +10,8 @@ services:
grep: memcached
service_name: memcached
driver: system_service
etcd:
args:
grep: etcd
service_name: devstack@etcd
driver: system_service

View File

@ -0,0 +1,30 @@
---
- hosts: all
roles:
- orchestrate-devstack
- hosts: all
tasks:
- name: Run integration tests
command: "tox -e {{tox_envlist}}"
args:
chdir: "/opt/stack/os-faults"
- hosts: all
vars:
- test_results_path: "/opt/stack/os-faults/.tox/{{tox_envlist}}/log/pytest_results.html"
tasks:
- name: Copy job results
become: yes
synchronize:
src: "{{ test_results_path }}"
dest: "{{ zuul.executor.log_root }}"
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- "--include=/**"
- "--include=*/"

View File

@ -20,14 +20,15 @@ from oslo_concurrency import processutils
from os_faults.tests.unit import test
CONFIG_FILE = os.path.join(os.path.dirname(__file__), 'os-faults.yaml')
LOG = logging.getLogger(__name__)
class TestOSInjectFault(test.TestCase):
class TestOSInjectFaultUniversalDriver(test.TestCase):
CONFIG_FILE = os.path.join(os.path.dirname(__file__),
'os-faults-universal.yaml')
def test_connect(self):
cmd = 'os-inject-fault -c %s -v' % CONFIG_FILE
cmd = 'os-inject-fault -c %s -v' % self.CONFIG_FILE
command_stdout, command_stderr = processutils.execute(
*shlex.split(cmd))
@ -35,14 +36,13 @@ class TestOSInjectFault(test.TestCase):
success = re.search('Connected to cloud successfully', command_stderr)
self.assertTrue(success)
class TestOSFaults(test.TestCase):
def test_connect(self):
cmd = 'os-faults verify -c %s' % CONFIG_FILE
def test_restart_etcd(self):
cmd = 'os-inject-fault -c %s restart etcd service' % self.CONFIG_FILE
command_stdout, command_stderr = processutils.execute(
*shlex.split(cmd))
success = re.search('Connected to cloud successfully', command_stderr)
print('stdout', command_stdout)
print('stderr', command_stderr)
success = re.search('successfully', command_stderr)
self.assertTrue(success)

21
tox.ini
View File

@ -57,25 +57,14 @@ basepython = python3
install_command = {[testenv:common-constraints]install_command}
commands = {[testenv:cover]commands}
[testenv:integration]
[testenv:devstack]
basepython = python3
setenv = {[testenv]setenv}
OS_TEST_PATH=./os_faults/tests/integration
OS_TEST_PATH=./os_faults/tests/devstack
deps = {[testenv]deps}
oslo.concurrency
extras =
commands =
py.test -vvvv --html={envlogdir}/pytest_results.html --self-contained-html --durations=10 "os_faults/tests/integration" {posargs}
[testenv:integration-py27]
basepython = python2.7
setenv = {[testenv:integration]setenv}
deps = {[testenv:integration]deps}
commands = {[testenv:integration]commands}
[testenv:integration-py35]
basepython = python3.5
setenv = {[testenv:integration]setenv}
deps = {[testenv:integration]deps}
commands = {[testenv:integration]commands}
py.test -vvvv --html={envlogdir}/pytest_results.html --self-contained-html --durations=10 "os_faults/tests/devstack" {posargs}
[testenv:docs]
basepython = python3