Refactored magnum tempest plugin
* It provides proper directory structure and cleanup of magnum tempest plugin tests. * Added tools/pretty_tox.sh to trigger functional api tests Change-Id: Ibdddd26da9cfb0d08c2977660320b2c052d7261b
This commit is contained in:
parent
a9ba679232
commit
4f8af5f2f8
13
README.rst
13
README.rst
@ -2,17 +2,12 @@
|
||||
openstack Magnum Tempest Plugin
|
||||
===============================
|
||||
|
||||
Tempest plugin for magnum Project
|
||||
Tempest plugin for Magnum Project
|
||||
|
||||
It contains the tempest tests for testing Container Infrastructure Management
|
||||
Service for OpenStack.
|
||||
|
||||
* Free software: Apache license
|
||||
* Documentation: http://docs.openstack.org/developer/openstack
|
||||
* Source: http://git.openstack.org/cgit/openstack/openstack
|
||||
* Bugs: http://bugs.launchpad.net/magnum_tempest_plugin
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* TODO
|
||||
* Documentation: http://docs.openstack.org/magnum/latest
|
||||
* Source: http://git.openstack.org/cgit/openstack/magnum-tempest-plugin
|
||||
* Bugs: http://bugs.launchpad.net/magnum
|
||||
|
@ -2,11 +2,12 @@
|
||||
Installation
|
||||
============
|
||||
|
||||
Tempest automatically discovers installed plugins. That's why you just need
|
||||
to install the Python packages that contains the Magnum Tempest plugin in
|
||||
the same environment where Tempest is installed.
|
||||
|
||||
At the command line::
|
||||
|
||||
$ pip install openstack
|
||||
|
||||
Or, if you have virtualenvwrapper installed::
|
||||
|
||||
$ mkvirtualenv openstack
|
||||
$ pip install openstack
|
||||
$ git clone https://git.openstack.org/cgit/openstack/magnum-tempest-plugin
|
||||
$ cd magnum-tempest-plugin/
|
||||
$ pip install -e .
|
||||
|
@ -16,10 +16,10 @@ import subprocess
|
||||
|
||||
from tempest.lib import base
|
||||
|
||||
import magnum
|
||||
import magnum_tempest_plugin
|
||||
|
||||
|
||||
COPY_LOG_HELPER = "magnum/tests/contrib/copy_instance_logs.sh"
|
||||
COPY_LOG_HELPER = "magnum_tempest_plugin/tests/contrib/copy_instance_logs.sh"
|
||||
|
||||
|
||||
class BaseMagnumTest(base.BaseTestCase):
|
||||
@ -53,7 +53,7 @@ class BaseMagnumTest(base.BaseTestCase):
|
||||
slave_nodes = nodes_addresses[1]
|
||||
|
||||
base_path = os.path.split(os.path.dirname(
|
||||
os.path.abspath(magnum.__file__)))[0]
|
||||
os.path.abspath(magnum_tempest_plugin.__file__)))[0]
|
||||
full_location = os.path.join(base_path, COPY_LOG_HELPER)
|
||||
|
||||
def do_copy_logs(prefix, nodes_address):
|
@ -16,7 +16,7 @@ import six
|
||||
from six.moves.urllib import parse
|
||||
from tempest.lib.common import rest_client
|
||||
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum_tempest_plugin.common import config
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
@ -17,16 +17,16 @@ import struct
|
||||
|
||||
from tempest.lib.common.utils import data_utils
|
||||
|
||||
from magnum.tests.functional.api.v1.models import bay_model
|
||||
from magnum.tests.functional.api.v1.models import baymodel_model
|
||||
from magnum.tests.functional.api.v1.models import baymodelpatch_model
|
||||
from magnum.tests.functional.api.v1.models import baypatch_model
|
||||
from magnum.tests.functional.api.v1.models import cert_model
|
||||
from magnum.tests.functional.api.v1.models import cluster_model
|
||||
from magnum.tests.functional.api.v1.models import cluster_template_model
|
||||
from magnum.tests.functional.api.v1.models import cluster_templatepatch_model
|
||||
from magnum.tests.functional.api.v1.models import clusterpatch_model
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum_tempest_plugin.common import config
|
||||
from magnum_tempest_plugin.tests.api.v1.models import bay_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import baymodel_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import baymodelpatch_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import baypatch_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cert_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_template_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_templatepatch_model # noqa
|
||||
from magnum_tempest_plugin.tests.api.v1.models import clusterpatch_model
|
||||
|
||||
|
||||
def random_int(min_int=1, max_int=100):
|
@ -13,14 +13,14 @@
|
||||
from tempest import clients
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
|
||||
from magnum.tests.functional.api.v1.clients import bay_client
|
||||
from magnum.tests.functional.api.v1.clients import baymodel_client
|
||||
from magnum.tests.functional.api.v1.clients import cert_client
|
||||
from magnum.tests.functional.api.v1.clients import cluster_client
|
||||
from magnum.tests.functional.api.v1.clients import cluster_template_client
|
||||
from magnum.tests.functional.api.v1.clients import magnum_service_client
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.common import config
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import bay_client
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import baymodel_client
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import cert_client
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import cluster_client
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import cluster_template_client
|
||||
from magnum_tempest_plugin.tests.api.v1.clients import magnum_service_client
|
||||
|
||||
|
||||
class Manager(clients.Manager):
|
@ -16,15 +16,14 @@ import os
|
||||
from tempest import config
|
||||
from tempest.test_discover import plugins
|
||||
|
||||
import magnum
|
||||
from magnum.tests.functional.tempest_tests import config as magnum_config
|
||||
from magnum_tempest_plugin import config as magnum_config
|
||||
|
||||
|
||||
class MagnumTempestPlugin(plugins.TempestPlugin):
|
||||
def load_tests(self):
|
||||
base_path = os.path.split(os.path.dirname(
|
||||
os.path.abspath(magnum.__file__)))[0]
|
||||
test_dir = "magnum/tests/functional/api/v1"
|
||||
os.path.abspath(__file__)))[0]
|
||||
test_dir = "magnum_tempest_plugin/tests/api/v1"
|
||||
full_test_dir = os.path.join(base_path, test_dir)
|
||||
return full_test_dir, base_path
|
||||
|
@ -15,9 +15,9 @@ import logging
|
||||
|
||||
from tempest.common import credentials_factory as common_creds
|
||||
|
||||
from magnum.tests.functional.common import base
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum.tests.functional.common import manager
|
||||
from magnum_tempest_plugin.common import base
|
||||
from magnum_tempest_plugin.common import config
|
||||
from magnum_tempest_plugin.common import manager
|
||||
|
||||
|
||||
COPY_LOG_HELPER = "magnum/tests/contrib/copy_instance_logs.sh"
|
@ -13,9 +13,9 @@
|
||||
from oslo_log import log as logging
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from magnum.tests.functional.api.v1.models import bay_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum.tests.functional.common import utils
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.common import utils
|
||||
from magnum_tempest_plugin.tests.api.v1.models import bay_model
|
||||
|
||||
|
||||
class BayClient(client.MagnumClient):
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.api.v1.models import baymodel_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.tests.api.v1.models import baymodel_model
|
||||
|
||||
|
||||
class BayModelClient(client.MagnumClient):
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.api.v1.models import cert_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cert_model
|
||||
|
||||
|
||||
class CertClient(client.MagnumClient):
|
@ -13,10 +13,10 @@
|
||||
from oslo_log import log as logging
|
||||
from tempest.lib import exceptions
|
||||
|
||||
from magnum.tests.functional.api.v1.models import cluster_id_model
|
||||
from magnum.tests.functional.api.v1.models import cluster_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum.tests.functional.common import utils
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.common import utils
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_id_model
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_model
|
||||
|
||||
|
||||
class ClusterClient(client.MagnumClient):
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.api.v1.models import cluster_template_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.tests.api.v1.models import cluster_template_model
|
||||
|
||||
|
||||
class ClusterTemplateClient(client.MagnumClient):
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.api.v1.models import magnum_service_model
|
||||
from magnum.tests.functional.common import client
|
||||
from magnum_tempest_plugin.common import client
|
||||
from magnum_tempest_plugin.tests.api.v1.models import magnum_service_model
|
||||
|
||||
|
||||
class MagnumServiceClient(client.MagnumClient):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class BayData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class BayModelData(models.BaseModel):
|
@ -12,7 +12,7 @@
|
||||
|
||||
import json
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class BayModelPatchData(models.BaseModel):
|
@ -12,7 +12,7 @@
|
||||
|
||||
import json
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class BayPatchData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class CertData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class ClusterIdData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class ClusterData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class ClusterTemplateData(models.BaseModel):
|
@ -12,7 +12,7 @@
|
||||
|
||||
import json
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class ClusterTemplatePatchData(models.BaseModel):
|
@ -12,7 +12,7 @@
|
||||
|
||||
import json
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class ClusterPatchData(models.BaseModel):
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from magnum.tests.functional.common import models
|
||||
from magnum_tempest_plugin.common import models
|
||||
|
||||
|
||||
class MagnumServiceData(models.BaseModel):
|
@ -18,9 +18,9 @@ from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import config
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class BayTest(base.BaseTempestTest):
|
@ -15,8 +15,8 @@ from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class BayModelTest(base.BaseTempestTest):
|
@ -13,8 +13,8 @@
|
||||
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class BayModelAdminTest(base.BaseTempestTest):
|
@ -18,9 +18,9 @@ from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import config
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import config
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
HEADERS = {'OpenStack-API-Version': 'container-infra latest',
|
@ -15,8 +15,8 @@ from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class ClusterTemplateTest(base.BaseTempestTest):
|
@ -13,8 +13,8 @@
|
||||
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum.tests.functional.common import datagen
|
||||
from magnum_tempest_plugin.common import datagen
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class ClusterTemplateAdminTest(base.BaseTempestTest):
|
@ -14,7 +14,7 @@
|
||||
from tempest.lib import exceptions
|
||||
import testtools
|
||||
|
||||
from magnum.tests.functional.api import base
|
||||
from magnum_tempest_plugin.tests.api import base
|
||||
|
||||
|
||||
class MagnumServiceTest(base.BaseTempestTest):
|
20
setup.cfg
20
setup.cfg
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = openstack
|
||||
summary = Tempest plugin magnum_tempest_plugin
|
||||
name = magnum_tempest_plugin
|
||||
summary = Tempest plugin for Magnum Project
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack
|
||||
@ -21,11 +21,11 @@ classifier =
|
||||
|
||||
[files]
|
||||
packages =
|
||||
magnum
|
||||
magnum_tempest_plugin
|
||||
|
||||
[entry_points]
|
||||
tempest.test_plugins =
|
||||
magnum_tests = magnum.tests.functional.tempest_tests.plugin:MagnumTempestPlugin
|
||||
magnum_tests = magnum_tempest_plugin.plugin:MagnumTempestPlugin
|
||||
|
||||
[build_sphinx]
|
||||
all-files = 1
|
||||
@ -37,15 +37,15 @@ build-dir = doc/build
|
||||
upload-dir = doc/build/html
|
||||
|
||||
[compile_catalog]
|
||||
directory = magnum/locale
|
||||
domain = magnum
|
||||
directory = magnum_tempest_plugin/locale
|
||||
domain = magnum_tempest_plugin
|
||||
|
||||
[update_catalog]
|
||||
domain = magnum
|
||||
output_dir = magnum/locale
|
||||
input_file = magnum/locale/magnum_tempest_plugin.pot
|
||||
domain = magnum_tempest_plugin
|
||||
output_dir = magnum_tempest_plugin/locale
|
||||
input_file = magnum_tempest_plugin/locale/magnum_tempest_plugin.pot
|
||||
|
||||
[extract_messages]
|
||||
keywords = _ gettext ngettext l_ lazy_gettext
|
||||
mapping_file = babel.cfg
|
||||
output_file = magnum/locale/magnum_tempest_plugin.pot
|
||||
output_file = magnum_tempest_plugin/locale/magnum_tempest_plugin.pot
|
||||
|
@ -4,12 +4,7 @@
|
||||
|
||||
hacking>=0.12.0,<0.13 # Apache-2.0
|
||||
|
||||
coverage>=4.0,!=4.4 # Apache-2.0
|
||||
python-subunit>=0.0.18 # Apache-2.0/BSD
|
||||
sphinx>=1.6.2 # BSD
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
testrepository>=0.0.18 # Apache-2.0/BSD
|
||||
testtools>=1.4.0 # MIT
|
||||
openstackdocstheme>=1.11.0 # Apache-2.0
|
||||
# releasenotes
|
||||
reno>=1.8.0 # Apache-2.0
|
||||
|
16
tools/pretty_tox.sh
Executable file
16
tools/pretty_tox.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o pipefail
|
||||
|
||||
TESTRARGS=$1
|
||||
|
||||
# --until-failure is not compatible with --subunit see:
|
||||
#
|
||||
# https://bugs.launchpad.net/testrepository/+bug/1411804
|
||||
#
|
||||
# this work around exists until that is addressed
|
||||
if [[ "$TESTARGS" =~ "until-failure" ]]; then
|
||||
python setup.py testr --slowest --testr-args="$TESTRARGS"
|
||||
else
|
||||
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | subunit-trace -f
|
||||
fi
|
12
tox.ini
12
tox.ini
@ -18,8 +18,16 @@ commands = flake8 {posargs}
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||
[testenv:functional-api]
|
||||
sitepackages = True
|
||||
setenv = {[testenv]setenv}
|
||||
OS_TEST_PATH=./magnum_tempest_plugin/tests/api
|
||||
OS_TEST_TIMEOUT=7200
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
find . -type f -name "*.py[c|o]" -delete
|
||||
bash tools/pretty_tox.sh '{posargs}'
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
Loading…
Reference in New Issue
Block a user