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
|
tox_envlist: functional
|
||||||
timeout: 3600
|
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:
|
- job:
|
||||||
name: kollacli-tox-mypy
|
name: kollacli-tox-mypy
|
||||||
parent: openstack-tox
|
parent: openstack-tox
|
||||||
|
@ -28,8 +42,10 @@
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- kollacli-tox-mypy
|
- kollacli-tox-mypy
|
||||||
- kollacli-tox-functional
|
- kollacli-tox-functional
|
||||||
|
- kollacli-tox-functional-py35
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-pep8
|
- openstack-tox-pep8
|
||||||
- kollacli-tox-mypy
|
- kollacli-tox-mypy
|
||||||
- kollacli-tox-functional
|
- kollacli-tox-functional
|
||||||
|
- kollacli-tox-functional-py35
|
||||||
|
|
|
@ -19,7 +19,6 @@ import os
|
||||||
import pwd
|
import pwd
|
||||||
import six
|
import six
|
||||||
import subprocess # nosec
|
import subprocess # nosec
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
@ -115,32 +114,10 @@ def get_lock_enabled():
|
||||||
|
|
||||||
|
|
||||||
def get_ansible_command(playbook=False):
|
def get_ansible_command(playbook=False):
|
||||||
"""get a python2 ansible command
|
"""Get the ansible command"""
|
||||||
|
|
||||||
Ansible cannot run yet with python3. If the current default
|
|
||||||
python is py3, prefix the ansible command with a py2
|
|
||||||
interpreter.
|
|
||||||
"""
|
|
||||||
cmd = 'ansible'
|
cmd = 'ansible'
|
||||||
if playbook:
|
if playbook:
|
||||||
cmd = 'ansible-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
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
As of change id: Id11cc1abcac6ac5b94176a1f17a8f5f82b6f00d5
|
- As of change id: Id11cc1abcac6ac5b94176a1f17a8f5f82b6f00d5
|
||||||
removed all tests which expected remote systems
|
removed all tests which expected remote systems
|
||||||
to be available / configured. These tests should be
|
to be available / configured. These tests should be
|
||||||
revived at some point using Tempest or something similar to run
|
revived at some point using Tempest or something similar to run
|
||||||
more complete functional tests.
|
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
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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.api.client import ClientApi
|
||||||
from kolla_cli.common.allinone import AllInOne
|
from kolla_cli.common.allinone import AllInOne
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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.api.client import ClientApi
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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.api.client import ClientApi
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from common import KollaCliTest
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import unittest
|
import unittest
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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.api.client import ClientApi
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,13 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
from kolla_cli.tests.functional.common import KollaCliTest
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from common import KollaCliTest
|
|
||||||
from kolla_cli.api.client import ClientApi
|
from kolla_cli.api.client import ClientApi
|
||||||
from kolla_cli.common.utils import get_tools_path
|
from kolla_cli.common.utils import get_tools_path
|
||||||
from kolla_cli.common.utils import safe_decode
|
from kolla_cli.common.utils import safe_decode
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -1,7 +1,7 @@
|
||||||
[tox]
|
[tox]
|
||||||
minversion = 1.6
|
minversion = 1.6
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
envlist = py27,pep8,mypy,functional
|
envlist = pep8,mypy,functional,functional-py35
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
usedevelop=True
|
usedevelop=True
|
||||||
|
@ -30,6 +30,12 @@ commands =
|
||||||
{toxinidir}/kolla_cli/tests/functional/functional_test_setup.sh
|
{toxinidir}/kolla_cli/tests/functional/functional_test_setup.sh
|
||||||
ostestr {posargs} --serial
|
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]
|
[testenv:pep8]
|
||||||
deps = {[testenv]deps}
|
deps = {[testenv]deps}
|
||||||
commands = flake8 {posargs}
|
commands = flake8 {posargs}
|
||||||
|
|
Loading…
Reference in New Issue