Enable py35 functional tests
This change sets up the functional tests to run on py35 in CI testing. This change also: - fixes some import problems only seen in py35. - removes obsolete/broken code that was needed when ansible didn't support py3. Partially Implements: blueprint initial-testing Change-Id: I3df34e266a8f64f4f963ded51adf8879a324be30
This commit is contained in:
parent
7c0bc714f1
commit
bca9db24ba
16
.zuul.yaml
16
.zuul.yaml
|
@ -13,6 +13,20 @@
|
|||
tox_envlist: functional
|
||||
timeout: 3600
|
||||
|
||||
- job:
|
||||
name: kollacli-tox-functional-py35
|
||||
parent: openstack-tox
|
||||
description: |
|
||||
Run tox-based py35 functional tests for the OpenStack Kolla-cli project.
|
||||
Uses tox with the ``functional`` environment.
|
||||
irrelevant-files:
|
||||
- ^.*\.rst$
|
||||
- ^doc/source/.*$
|
||||
- ^releasenotes/.*$
|
||||
vars:
|
||||
tox_envlist: functional-py35
|
||||
timeout: 3600
|
||||
|
||||
- job:
|
||||
name: kollacli-tox-mypy
|
||||
parent: openstack-tox
|
||||
|
@ -28,8 +42,10 @@
|
|||
- openstack-tox-pep8
|
||||
- kollacli-tox-mypy
|
||||
- kollacli-tox-functional
|
||||
- kollacli-tox-functional-py35
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8
|
||||
- kollacli-tox-mypy
|
||||
- kollacli-tox-functional
|
||||
- kollacli-tox-functional-py35
|
||||
|
|
|
@ -19,7 +19,6 @@ import os
|
|||
import pwd
|
||||
import six
|
||||
import subprocess # nosec
|
||||
import sys
|
||||
import time
|
||||
import yaml
|
||||
|
||||
|
@ -115,32 +114,10 @@ def get_lock_enabled():
|
|||
|
||||
|
||||
def get_ansible_command(playbook=False):
|
||||
"""get a python2 ansible command
|
||||
|
||||
Ansible cannot run yet with python3. If the current default
|
||||
python is py3, prefix the ansible command with a py2
|
||||
interpreter.
|
||||
"""
|
||||
"""Get the ansible command"""
|
||||
cmd = 'ansible'
|
||||
if playbook:
|
||||
cmd = 'ansible-playbook'
|
||||
if sys.version_info[0] >= 3:
|
||||
# running with py3, find a py2 interpreter for ansible
|
||||
py2_path = None
|
||||
usr_bin = os.path.join('/', 'usr', 'bin')
|
||||
for fname in os.listdir(usr_bin):
|
||||
if (fname.startswith('python2.') and
|
||||
os.path.isfile(os.path.join(usr_bin, fname))):
|
||||
suffix = fname.split('.')[1]
|
||||
if suffix.isdigit():
|
||||
py2_path = os.path.join(usr_bin, fname)
|
||||
break
|
||||
if py2_path is None:
|
||||
raise Exception(
|
||||
u._('ansible-playbook requires python2 and no '
|
||||
'python2 interpreter found in {path}.')
|
||||
.format(path=usr_bin))
|
||||
cmd = '%s %s' % (py2_path, os.path.join(usr_bin, cmd))
|
||||
return cmd
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,19 @@
|
|||
As of change id: Id11cc1abcac6ac5b94176a1f17a8f5f82b6f00d5
|
||||
- As of change id: Id11cc1abcac6ac5b94176a1f17a8f5f82b6f00d5
|
||||
removed all tests which expected remote systems
|
||||
to be available / configured. These tests should be
|
||||
revived at some point using Tempest or something similar to run
|
||||
more complete functional tests.
|
||||
|
||||
- To run a single functional test, you will need to setup these
|
||||
environmental variables and the needed file structure:
|
||||
|
||||
export KOLLA_ETC=/tmp/kollaclitest/etc/kolla/
|
||||
export KOLLA_HOME=/tmp/kollaclitest/usr/share/kolla-ansible/
|
||||
export KOLLA_TOOLS_DIR=./tools/
|
||||
|
||||
./kolla_cli/tests/functional/functional_test_setup.sh
|
||||
|
||||
Then you can run a single test, for eg:
|
||||
|
||||
source .tox/functional/bin/activate
|
||||
ostestr -n kolla_cli.tests.functional.test_deploy.TestFunctional.test_deploy
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
from kolla_cli.api.client import ClientApi
|
||||
from kolla_cli.common.allinone import AllInOne
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
from kolla_cli.api.client import ClientApi
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import json
|
||||
import os
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
import os
|
||||
import unittest
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import json
|
||||
import os
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
from kolla_cli.api.client import ClientApi
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import json
|
||||
import unittest
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
from kolla_cli.api.client import ClientApi
|
||||
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
from kolla_cli.tests.functional.common import KollaCliTest
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import tarfile
|
||||
import unittest
|
||||
|
||||
from common import KollaCliTest
|
||||
from kolla_cli.api.client import ClientApi
|
||||
from kolla_cli.common.utils import get_tools_path
|
||||
from kolla_cli.common.utils import safe_decode
|
||||
|
|
8
tox.ini
8
tox.ini
|
@ -1,7 +1,7 @@
|
|||
[tox]
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
envlist = py27,pep8,mypy,functional
|
||||
envlist = pep8,mypy,functional,functional-py35
|
||||
|
||||
[testenv]
|
||||
usedevelop=True
|
||||
|
@ -30,6 +30,12 @@ commands =
|
|||
{toxinidir}/kolla_cli/tests/functional/functional_test_setup.sh
|
||||
ostestr {posargs} --serial
|
||||
|
||||
[testenv:functional-py35]
|
||||
basepython = py35: python3.5
|
||||
setenv = {[testenv:functional]setenv}
|
||||
commands = {[testenv:functional]commands}
|
||||
whitelist_externals = {[testenv:functional]whitelist_externals}
|
||||
|
||||
[testenv:pep8]
|
||||
deps = {[testenv]deps}
|
||||
commands = flake8 {posargs}
|
||||
|
|
Loading…
Reference in New Issue