Run jobs under python2 and python3
-Switch functional job to run under python3 -Create a functional job to run under python2 -Create a tempest job to run under python2 -Create tox env to run functional tests under python3 -Validate if `USE_PYTHON3` is set to `True` to call the correct env for tests -Remove hardcoded path for client when running functional tests - Update tests failures to work for python2 and python3 Change-Id: I55abc999f6f397b171d05fd9e9b39d833ca95e55
This commit is contained in:
parent
66392a90df
commit
9b881cb973
@ -37,7 +37,8 @@ class FunctionalTestBase(base.ClientTestBase):
|
|||||||
def _get_clients(self):
|
def _get_clients(self):
|
||||||
# NOTE(aarefiev): {toxinidir} is a current working directory, so
|
# NOTE(aarefiev): {toxinidir} is a current working directory, so
|
||||||
# the tox env path is {toxinidir}/.tox
|
# the tox env path is {toxinidir}/.tox
|
||||||
cli_dir = os.path.join(os.path.abspath('.'), '.tox/functional/bin')
|
venv_name = os.environ.get('OS_TESTENV_NAME', 'functional')
|
||||||
|
cli_dir = os.path.join(os.path.abspath('.'), '.tox/%s/bin' % venv_name)
|
||||||
|
|
||||||
config = self._get_config()
|
config = self._get_config()
|
||||||
if config.get('os_auth_url'):
|
if config.get('os_auth_url'):
|
||||||
|
@ -140,7 +140,7 @@ class BaremetalAllocationTests(base.TestCase):
|
|||||||
('--trait', 'foo',
|
('--trait', 'foo',
|
||||||
'A custom trait must start with the prefix CUSTOM_'),
|
'A custom trait must start with the prefix CUSTOM_'),
|
||||||
('--candidate-node', '', 'expected one argument'),
|
('--candidate-node', '', 'expected one argument'),
|
||||||
('--candidate-node', 'banana?', 'Expected a logical name or UUID'),
|
('--candidate-node', 'banana?', 'Nodes cannot be found'),
|
||||||
('--wait', 'meow', 'invalid int value'))
|
('--wait', 'meow', 'invalid int value'))
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
def test_create_negative(self, argument, value, ex_text):
|
def test_create_negative(self, argument, value, ex_text):
|
||||||
@ -156,5 +156,5 @@ class BaremetalAllocationTests(base.TestCase):
|
|||||||
"""Check errors on missing resource class."""
|
"""Check errors on missing resource class."""
|
||||||
base_cmd = 'baremetal allocation create'
|
base_cmd = 'baremetal allocation create'
|
||||||
self.assertRaisesRegex(exceptions.CommandFailed,
|
self.assertRaisesRegex(exceptions.CommandFailed,
|
||||||
'--resource-class is required',
|
'--resource-class',
|
||||||
self.openstack, base_cmd)
|
self.openstack, base_cmd)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
|
import six
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
|
||||||
@ -159,7 +160,9 @@ class BaremetalDeployTemplateTests(base.TestCase):
|
|||||||
@ddt.data(
|
@ddt.data(
|
||||||
('--uuid', '', 'expected one argument'),
|
('--uuid', '', 'expected one argument'),
|
||||||
('--uuid', '!@#$^*&%^', 'Expected a UUID'),
|
('--uuid', '!@#$^*&%^', 'Expected a UUID'),
|
||||||
('', '', 'too few arguments'),
|
('', '',
|
||||||
|
'too few arguments' if six.PY2
|
||||||
|
else 'the following arguments are required'),
|
||||||
('', 'not/a/name', 'Deploy template name must be a valid trait'),
|
('', 'not/a/name', 'Deploy template name must be a valid trait'),
|
||||||
('', 'foo', 'Deploy template name must be a valid trait'),
|
('', 'foo', 'Deploy template name must be a valid trait'),
|
||||||
('--steps', '', 'expected one argument'),
|
('--steps', '', 'expected one argument'),
|
||||||
|
@ -28,7 +28,9 @@ class BaremetalNodeNegativeTests(base.TestCase):
|
|||||||
self.node = self.node_create()
|
self.node = self.node_create()
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
('', '', 'error: argument --driver is required'),
|
('', '',
|
||||||
|
'error: argument --driver is required' if six.PY2
|
||||||
|
else 'error: the following arguments are required: --driver'),
|
||||||
('--driver', 'wrongdriver',
|
('--driver', 'wrongdriver',
|
||||||
'No valid host was found. Reason: No conductor service '
|
'No valid host was found. Reason: No conductor service '
|
||||||
'registered which supports driver wrongdriver.')
|
'registered which supports driver wrongdriver.')
|
||||||
@ -45,6 +47,8 @@ class BaremetalNodeNegativeTests(base.TestCase):
|
|||||||
"""Test for baremetal node delete without node specified."""
|
"""Test for baremetal node delete without node specified."""
|
||||||
command = 'baremetal node delete'
|
command = 'baremetal node delete'
|
||||||
ex_text = 'error: too few arguments'
|
ex_text = 'error: too few arguments'
|
||||||
|
if six.PY3:
|
||||||
|
ex_text = ''
|
||||||
six.assertRaisesRegex(self, exceptions.CommandFailed, ex_text,
|
six.assertRaisesRegex(self, exceptions.CommandFailed, ex_text,
|
||||||
self.openstack, command)
|
self.openstack, command)
|
||||||
|
|
||||||
@ -56,7 +60,9 @@ class BaremetalNodeNegativeTests(base.TestCase):
|
|||||||
self.openstack, command)
|
self.openstack, command)
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
('--property', '', 'error: too few arguments'),
|
('--property', '',
|
||||||
|
'error: too few arguments' if six.PY2
|
||||||
|
else 'error: the following arguments are required: <node>'),
|
||||||
('--property', 'prop', 'Attributes must be a list of PATH=VALUE')
|
('--property', 'prop', 'Attributes must be a list of PATH=VALUE')
|
||||||
)
|
)
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
@ -69,7 +75,9 @@ class BaremetalNodeNegativeTests(base.TestCase):
|
|||||||
self.openstack, command)
|
self.openstack, command)
|
||||||
|
|
||||||
@ddt.data(
|
@ddt.data(
|
||||||
('--property', '', 'error: too few arguments'),
|
('--property', '',
|
||||||
|
'error: too few arguments' if six.PY2
|
||||||
|
else 'error: the following arguments are required: <node>'),
|
||||||
('--property', 'prop', "Reason: can't remove non-existent object")
|
('--property', 'prop', "Reason: can't remove non-existent object")
|
||||||
)
|
)
|
||||||
@ddt.unpack
|
@ddt.unpack
|
||||||
|
@ -132,7 +132,7 @@ class ChassisNegativeTestsIronicClient(base.FunctionalTestBase):
|
|||||||
1) check that chassis-delete command without arguments
|
1) check that chassis-delete command without arguments
|
||||||
triggers an exception
|
triggers an exception
|
||||||
"""
|
"""
|
||||||
ex_text = r'chassis-delete: error: too few arguments'
|
ex_text = r'chassis-delete: error:'
|
||||||
|
|
||||||
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
||||||
ex_text,
|
ex_text,
|
||||||
@ -159,7 +159,7 @@ class ChassisNegativeTestsIronicClient(base.FunctionalTestBase):
|
|||||||
1) check that chassis-show command without arguments
|
1) check that chassis-show command without arguments
|
||||||
triggers an exception
|
triggers an exception
|
||||||
"""
|
"""
|
||||||
ex_text = r'chassis-show: error: too few arguments'
|
ex_text = r'chassis-show: error:'
|
||||||
|
|
||||||
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
||||||
ex_text,
|
ex_text,
|
||||||
@ -187,7 +187,7 @@ class ChassisNegativeTestsIronicClient(base.FunctionalTestBase):
|
|||||||
2) check that chassis-update command without arguments
|
2) check that chassis-update command without arguments
|
||||||
triggers an exception
|
triggers an exception
|
||||||
"""
|
"""
|
||||||
ex_text = r'chassis-update: error: too few arguments'
|
ex_text = r'chassis-update: error:'
|
||||||
|
|
||||||
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
six.assertRaisesRegex(self, exceptions.CommandFailed,
|
||||||
ex_text,
|
ex_text,
|
||||||
@ -203,7 +203,7 @@ class ChassisNegativeTestsIronicClient(base.FunctionalTestBase):
|
|||||||
triggers an exception
|
triggers an exception
|
||||||
"""
|
"""
|
||||||
uuid = data_utils.rand_uuid()
|
uuid = data_utils.rand_uuid()
|
||||||
ex_text = r'chassis-update: error: too few arguments'
|
ex_text = r'chassis-update: error:'
|
||||||
|
|
||||||
six.assertRaisesRegex(self,
|
six.assertRaisesRegex(self,
|
||||||
exceptions.CommandFailed,
|
exceptions.CommandFailed,
|
||||||
|
@ -44,6 +44,12 @@
|
|||||||
export IRONICCLIENT_TEST_CONFIG=$CONFIG_FILE
|
export IRONICCLIENT_TEST_CONFIG=$CONFIG_FILE
|
||||||
|
|
||||||
cd $IRONICCLIENT_DIR
|
cd $IRONICCLIENT_DIR
|
||||||
tox -e functional
|
if [[ $USE_PYTHON3 == "True" ]]; then
|
||||||
|
echo 'Running Functional Tests under Python3'
|
||||||
|
tox -e functionalpy3
|
||||||
|
else
|
||||||
|
echo 'Running Functional Tests under Python2'
|
||||||
|
tox -e functional
|
||||||
|
fi
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
chdir: '/opt/stack/python-ironicclient'
|
chdir: '/opt/stack/python-ironicclient'
|
||||||
|
8
tox.ini
8
tox.ini
@ -56,6 +56,14 @@ commands = {posargs}
|
|||||||
passenv = *
|
passenv = *
|
||||||
setenv = TESTS_DIR=./ironicclient/tests/functional
|
setenv = TESTS_DIR=./ironicclient/tests/functional
|
||||||
LANGUAGE=en_US
|
LANGUAGE=en_US
|
||||||
|
OS_TESTENV_NAME = {envname}
|
||||||
|
|
||||||
|
[testenv:functionalpy3]
|
||||||
|
basepython = python3
|
||||||
|
passenv = *
|
||||||
|
setenv = TESTS_DIR=./ironicclient/tests/functional
|
||||||
|
LANGUAGE=en_US
|
||||||
|
OS_TESTENV_NAME = {envname}
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
vars:
|
vars:
|
||||||
tox_environment:
|
tox_environment:
|
||||||
PYTHONUNBUFFERED: 'true'
|
PYTHONUNBUFFERED: 'true'
|
||||||
tox_envlist: functional
|
tox_envlist: functionalpy3
|
||||||
devstack_plugins:
|
devstack_plugins:
|
||||||
ironic: git://git.openstack.org/openstack/ironic
|
ironic: git://git.openstack.org/openstack/ironic
|
||||||
devstack_localrc:
|
devstack_localrc:
|
||||||
USE_PYTHON3: False
|
USE_PYTHON3: True
|
||||||
EBTABLES_RACE_FIX: True
|
EBTABLES_RACE_FIX: True
|
||||||
IRONIC_ENABLED_NETWORK_INTERFACES: noop
|
IRONIC_ENABLED_NETWORK_INTERFACES: noop
|
||||||
IRONIC_DHCP_PROVIDER: none
|
IRONIC_DHCP_PROVIDER: none
|
||||||
@ -35,6 +35,14 @@
|
|||||||
mysql: True
|
mysql: True
|
||||||
rabbit: True
|
rabbit: True
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: ironicclient-functional-python2
|
||||||
|
parent: ironicclient-functional
|
||||||
|
post-run: playbooks/functional/run.yaml
|
||||||
|
vars:
|
||||||
|
tox_envlist: functional
|
||||||
|
devstack_localrc:
|
||||||
|
USE_PYTHON3: False
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ironicclient-tempest
|
name: ironicclient-tempest
|
||||||
@ -46,3 +54,10 @@
|
|||||||
devstack_localrc:
|
devstack_localrc:
|
||||||
USE_PYTHON3: True
|
USE_PYTHON3: True
|
||||||
EBTABLES_RACE_FIX: True
|
EBTABLES_RACE_FIX: True
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: ironicclient-tempest-python2
|
||||||
|
parent: ironicclient-tempest
|
||||||
|
vars:
|
||||||
|
devstack_localrc:
|
||||||
|
USE_PYTHON3: False
|
||||||
|
@ -13,9 +13,13 @@
|
|||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- ironicclient-functional
|
- ironicclient-functional
|
||||||
|
- ironicclient-functional-python2
|
||||||
- ironicclient-tempest
|
- ironicclient-tempest
|
||||||
|
- ironicclient-tempest-python2
|
||||||
gate:
|
gate:
|
||||||
queue: ironic
|
queue: ironic
|
||||||
jobs:
|
jobs:
|
||||||
- ironicclient-functional
|
- ironicclient-functional
|
||||||
|
- ironicclient-functional-python2
|
||||||
- ironicclient-tempest
|
- ironicclient-tempest
|
||||||
|
- ironicclient-tempest-python2
|
||||||
|
Loading…
Reference in New Issue
Block a user