diff --git a/.zuul.yaml b/.zuul.yaml index a84b671..e14019c 100644 --- a/.zuul.yaml +++ b/.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 diff --git a/kolla_cli/common/utils.py b/kolla_cli/common/utils.py index 4fb4c80..672434f 100644 --- a/kolla_cli/common/utils.py +++ b/kolla_cli/common/utils.py @@ -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 diff --git a/kolla_cli/tests/functional/README.txt b/kolla_cli/tests/functional/README.txt index e3b2d96..fd0081d 100644 --- a/kolla_cli/tests/functional/README.txt +++ b/kolla_cli/tests/functional/README.txt @@ -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 diff --git a/kolla_cli/tests/functional/test_client_upgrade.py b/kolla_cli/tests/functional/test_client_upgrade.py index f0c340c..eef3fa6 100644 --- a/kolla_cli/tests/functional/test_client_upgrade.py +++ b/kolla_cli/tests/functional/test_client_upgrade.py @@ -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 diff --git a/kolla_cli/tests/functional/test_deploy.py b/kolla_cli/tests/functional/test_deploy.py index 537be10..3e50eb2 100644 --- a/kolla_cli/tests/functional/test_deploy.py +++ b/kolla_cli/tests/functional/test_deploy.py @@ -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 diff --git a/kolla_cli/tests/functional/test_destroy.py b/kolla_cli/tests/functional/test_destroy.py index 0d41951..279e9e7 100644 --- a/kolla_cli/tests/functional/test_destroy.py +++ b/kolla_cli/tests/functional/test_destroy.py @@ -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 diff --git a/kolla_cli/tests/functional/test_group.py b/kolla_cli/tests/functional/test_group.py index 7925839..49fb15f 100644 --- a/kolla_cli/tests/functional/test_group.py +++ b/kolla_cli/tests/functional/test_group.py @@ -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 diff --git a/kolla_cli/tests/functional/test_host.py b/kolla_cli/tests/functional/test_host.py index d1acaa5..73ba7ae 100644 --- a/kolla_cli/tests/functional/test_host.py +++ b/kolla_cli/tests/functional/test_host.py @@ -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 diff --git a/kolla_cli/tests/functional/test_password.py b/kolla_cli/tests/functional/test_password.py index 1c44f37..2c8fb7c 100644 --- a/kolla_cli/tests/functional/test_password.py +++ b/kolla_cli/tests/functional/test_password.py @@ -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 diff --git a/kolla_cli/tests/functional/test_property.py b/kolla_cli/tests/functional/test_property.py index ef8d5fa..65d66c5 100644 --- a/kolla_cli/tests/functional/test_property.py +++ b/kolla_cli/tests/functional/test_property.py @@ -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 diff --git a/kolla_cli/tests/functional/test_reconfigure.py b/kolla_cli/tests/functional/test_reconfigure.py index adb61bf..207a78b 100644 --- a/kolla_cli/tests/functional/test_reconfigure.py +++ b/kolla_cli/tests/functional/test_reconfigure.py @@ -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 diff --git a/kolla_cli/tests/functional/test_service.py b/kolla_cli/tests/functional/test_service.py index 4cda720..4fb6e0b 100644 --- a/kolla_cli/tests/functional/test_service.py +++ b/kolla_cli/tests/functional/test_service.py @@ -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 diff --git a/kolla_cli/tests/functional/test_stop.py b/kolla_cli/tests/functional/test_stop.py index 48f1ee9..3a2d058 100644 --- a/kolla_cli/tests/functional/test_stop.py +++ b/kolla_cli/tests/functional/test_stop.py @@ -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 diff --git a/kolla_cli/tests/functional/test_support.py b/kolla_cli/tests/functional/test_support.py index 69b9afa..63c95d8 100644 --- a/kolla_cli/tests/functional/test_support.py +++ b/kolla_cli/tests/functional/test_support.py @@ -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 diff --git a/tox.ini b/tox.ini index 5ef0ea5..3556493 100644 --- a/tox.ini +++ b/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}