diff --git a/aodh/tests/api/__init__.py b/aodh/tests/functional/api/__init__.py similarity index 99% rename from aodh/tests/api/__init__.py rename to aodh/tests/functional/api/__init__.py index a9cf235a9..62980f8ac 100644 --- a/aodh/tests/api/__init__.py +++ b/aodh/tests/functional/api/__init__.py @@ -21,7 +21,7 @@ import pecan import pecan.testing from aodh import service -from aodh.tests import db as db_test_base +from aodh.tests.functional import db as db_test_base class FunctionalTest(db_test_base.TestBase): diff --git a/aodh/tests/api/test_app.py b/aodh/tests/functional/api/test_app.py similarity index 100% rename from aodh/tests/api/test_app.py rename to aodh/tests/functional/api/test_app.py diff --git a/aodh/tests/api/test_versions.py b/aodh/tests/functional/api/test_versions.py similarity index 97% rename from aodh/tests/api/test_versions.py rename to aodh/tests/functional/api/test_versions.py index b76f72988..5dd8c251d 100644 --- a/aodh/tests/api/test_versions.py +++ b/aodh/tests/functional/api/test_versions.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from aodh.tests import api +from aodh.tests.functional import api V2_MEDIA_TYPES = [ { diff --git a/aodh/tests/api/v2/__init__.py b/aodh/tests/functional/api/v2/__init__.py similarity index 94% rename from aodh/tests/api/v2/__init__.py rename to aodh/tests/functional/api/v2/__init__.py index 71bd7354e..7f9e7354a 100644 --- a/aodh/tests/api/v2/__init__.py +++ b/aodh/tests/functional/api/v2/__init__.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from aodh.tests import api +from aodh.tests.functional import api class FunctionalTest(api.FunctionalTest): diff --git a/aodh/tests/api/v2/test_acl_scenarios.py b/aodh/tests/functional/api/v2/test_acl_scenarios.py similarity index 95% rename from aodh/tests/api/v2/test_acl_scenarios.py rename to aodh/tests/functional/api/v2/test_acl_scenarios.py index bdc4a7ed7..8cf5da196 100644 --- a/aodh/tests/api/v2/test_acl_scenarios.py +++ b/aodh/tests/functional/api/v2/test_acl_scenarios.py @@ -19,8 +19,8 @@ import mock import webtest from aodh.api import app -from aodh.tests.api import v2 -from aodh.tests import db as tests_db +from aodh.tests.functional.api import v2 +from aodh.tests.functional import db as tests_db class TestAPIACL(v2.FunctionalTest, diff --git a/aodh/tests/api/v2/test_alarm_scenarios.py b/aodh/tests/functional/api/v2/test_alarm_scenarios.py similarity index 99% rename from aodh/tests/api/v2/test_alarm_scenarios.py rename to aodh/tests/functional/api/v2/test_alarm_scenarios.py index fda53bd71..eb6415874 100644 --- a/aodh/tests/api/v2/test_alarm_scenarios.py +++ b/aodh/tests/functional/api/v2/test_alarm_scenarios.py @@ -27,9 +27,9 @@ import six.moves.urllib.parse as urlparse from aodh import messaging from aodh.storage import models -from aodh.tests.api import v2 from aodh.tests import constants -from aodh.tests import db as tests_db +from aodh.tests.functional.api import v2 +from aodh.tests.functional import db as tests_db def default_alarms(auth_headers): diff --git a/aodh/tests/api/v2/test_app.py b/aodh/tests/functional/api/v2/test_app.py similarity index 99% rename from aodh/tests/api/v2/test_app.py rename to aodh/tests/functional/api/v2/test_app.py index 86a012679..9a78f1121 100644 --- a/aodh/tests/api/v2/test_app.py +++ b/aodh/tests/functional/api/v2/test_app.py @@ -22,7 +22,7 @@ import six import wsme from aodh import i18n -from aodh.tests.api import v2 +from aodh.tests.functional.api import v2 class TestApiMiddleware(v2.FunctionalTest): diff --git a/aodh/tests/api/v2/test_capabilities.py b/aodh/tests/functional/api/v2/test_capabilities.py similarity index 92% rename from aodh/tests/api/v2/test_capabilities.py rename to aodh/tests/functional/api/v2/test_capabilities.py index 2da573de3..775f4dbcf 100644 --- a/aodh/tests/api/v2/test_capabilities.py +++ b/aodh/tests/functional/api/v2/test_capabilities.py @@ -17,8 +17,8 @@ import testscenarios -from aodh.tests.api import v2 as tests_api -from aodh.tests import db as tests_db +from aodh.tests.functional.api import v2 as tests_api +from aodh.tests.functional import db as tests_db load_tests = testscenarios.load_tests_apply_scenarios diff --git a/aodh/tests/api/v2/test_complex_query.py b/aodh/tests/functional/api/v2/test_complex_query.py similarity index 100% rename from aodh/tests/api/v2/test_complex_query.py rename to aodh/tests/functional/api/v2/test_complex_query.py diff --git a/aodh/tests/api/v2/test_complex_query_scenarios.py b/aodh/tests/functional/api/v2/test_complex_query_scenarios.py similarity index 99% rename from aodh/tests/api/v2/test_complex_query_scenarios.py rename to aodh/tests/functional/api/v2/test_complex_query_scenarios.py index c46bde0a7..a839f1f7d 100644 --- a/aodh/tests/api/v2/test_complex_query_scenarios.py +++ b/aodh/tests/functional/api/v2/test_complex_query_scenarios.py @@ -23,8 +23,8 @@ import datetime from oslo_utils import timeutils from aodh.storage import models -from aodh.tests.api import v2 as tests_api -from aodh.tests import db as tests_db +from aodh.tests.functional.api import v2 as tests_api +from aodh.tests.functional import db as tests_db admin_header = {"X-Roles": "admin", diff --git a/aodh/tests/api/v2/test_query.py b/aodh/tests/functional/api/v2/test_query.py similarity index 100% rename from aodh/tests/api/v2/test_query.py rename to aodh/tests/functional/api/v2/test_query.py diff --git a/aodh/tests/api/v2/test_wsme_custom_type.py b/aodh/tests/functional/api/v2/test_wsme_custom_type.py similarity index 100% rename from aodh/tests/api/v2/test_wsme_custom_type.py rename to aodh/tests/functional/api/v2/test_wsme_custom_type.py diff --git a/aodh/tests/db.py b/aodh/tests/functional/db.py similarity index 100% rename from aodh/tests/db.py rename to aodh/tests/functional/db.py diff --git a/aodh/tests/gabbi/fixtures.py b/aodh/tests/functional/gabbi/fixtures.py similarity index 100% rename from aodh/tests/gabbi/fixtures.py rename to aodh/tests/functional/gabbi/fixtures.py diff --git a/aodh/tests/functional/gabbi/gabbits-live/alarming.yaml b/aodh/tests/functional/gabbi/gabbits-live/alarms.yaml similarity index 100% rename from aodh/tests/functional/gabbi/gabbits-live/alarming.yaml rename to aodh/tests/functional/gabbi/gabbits-live/alarms.yaml diff --git a/aodh/tests/gabbi/gabbits/alarms.yaml b/aodh/tests/functional/gabbi/gabbits/alarms.yaml similarity index 100% rename from aodh/tests/gabbi/gabbits/alarms.yaml rename to aodh/tests/functional/gabbi/gabbits/alarms.yaml diff --git a/aodh/tests/gabbi/gabbits/basic.yaml b/aodh/tests/functional/gabbi/gabbits/basic.yaml similarity index 100% rename from aodh/tests/gabbi/gabbits/basic.yaml rename to aodh/tests/functional/gabbi/gabbits/basic.yaml diff --git a/aodh/tests/gabbi/gabbits/capabilities.yaml b/aodh/tests/functional/gabbi/gabbits/capabilities.yaml similarity index 100% rename from aodh/tests/gabbi/gabbits/capabilities.yaml rename to aodh/tests/functional/gabbi/gabbits/capabilities.yaml diff --git a/aodh/tests/gabbi/test_gabbi.py b/aodh/tests/functional/gabbi/test_gabbi.py similarity index 94% rename from aodh/tests/gabbi/test_gabbi.py rename to aodh/tests/functional/gabbi/test_gabbi.py index 004f79587..284530cee 100644 --- a/aodh/tests/gabbi/test_gabbi.py +++ b/aodh/tests/functional/gabbi/test_gabbi.py @@ -23,7 +23,7 @@ import os from gabbi import driver from aodh.api import app -from aodh.tests.gabbi import fixtures as fixture_module +from aodh.tests.functional.gabbi import fixtures as fixture_module TESTS_DIR = 'gabbits' diff --git a/aodh/tests/functional/gabbi/test_gabbi_live.py b/aodh/tests/functional/gabbi/test_gabbi_live.py index af72a84de..ff6dfa1d3 100644 --- a/aodh/tests/functional/gabbi/test_gabbi_live.py +++ b/aodh/tests/functional/gabbi/test_gabbi_live.py @@ -13,7 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -"""A test module to exercise the Gnocchi API with gabbi.""" +""" +A test module to exercise the Gnocchi API with gabbi. + +This is designed to run against a real running web server (started by +devstack). +""" import os diff --git a/aodh/tests/gabbi/__init__.py b/aodh/tests/functional/storage/__init__.py similarity index 100% rename from aodh/tests/gabbi/__init__.py rename to aodh/tests/functional/storage/__init__.py diff --git a/aodh/tests/storage/__init__.py b/aodh/tests/functional/storage/sqlalchemy/__init__.py similarity index 100% rename from aodh/tests/storage/__init__.py rename to aodh/tests/functional/storage/sqlalchemy/__init__.py diff --git a/aodh/tests/storage/sqlalchemy/test_migrations.py b/aodh/tests/functional/storage/sqlalchemy/test_migrations.py similarity index 96% rename from aodh/tests/storage/sqlalchemy/test_migrations.py rename to aodh/tests/functional/storage/sqlalchemy/test_migrations.py index 52ae3cce6..e3f184e67 100644 --- a/aodh/tests/storage/sqlalchemy/test_migrations.py +++ b/aodh/tests/functional/storage/sqlalchemy/test_migrations.py @@ -20,7 +20,7 @@ import six from aodh.storage.sqlalchemy import models from aodh.tests import base -from aodh.tests import db as tests_db +from aodh.tests.functional import db as tests_db class ABCSkip(base.SkipNotImplementedMeta, abc.ABCMeta): diff --git a/aodh/tests/storage/sqlalchemy/test_models.py b/aodh/tests/functional/storage/sqlalchemy/test_models.py similarity index 100% rename from aodh/tests/storage/sqlalchemy/test_models.py rename to aodh/tests/functional/storage/sqlalchemy/test_models.py diff --git a/aodh/tests/storage/test_get_connection.py b/aodh/tests/functional/storage/test_get_connection.py similarity index 100% rename from aodh/tests/storage/test_get_connection.py rename to aodh/tests/functional/storage/test_get_connection.py diff --git a/aodh/tests/storage/test_impl_hbase.py b/aodh/tests/functional/storage/test_impl_hbase.py similarity index 97% rename from aodh/tests/storage/test_impl_hbase.py rename to aodh/tests/functional/storage/test_impl_hbase.py index 0cfa71af0..020490b08 100644 --- a/aodh/tests/storage/test_impl_hbase.py +++ b/aodh/tests/functional/storage/test_impl_hbase.py @@ -30,7 +30,7 @@ except ImportError: from aodh.storage import impl_hbase from aodh.tests import base as test_base -from aodh.tests import db as tests_db +from aodh.tests.functional import db as tests_db class ConnectionTest(tests_db.TestBase, diff --git a/aodh/tests/storage/test_impl_log.py b/aodh/tests/functional/storage/test_impl_log.py similarity index 100% rename from aodh/tests/storage/test_impl_log.py rename to aodh/tests/functional/storage/test_impl_log.py diff --git a/aodh/tests/storage/test_impl_mongodb.py b/aodh/tests/functional/storage/test_impl_mongodb.py similarity index 98% rename from aodh/tests/storage/test_impl_mongodb.py rename to aodh/tests/functional/storage/test_impl_mongodb.py index 6f55c3228..e106241e5 100644 --- a/aodh/tests/storage/test_impl_mongodb.py +++ b/aodh/tests/functional/storage/test_impl_mongodb.py @@ -23,7 +23,7 @@ from aodh.storage import impl_mongodb from aodh.tests import base as test_base -from aodh.tests import db as tests_db +from aodh.tests.functional import db as tests_db @tests_db.run_with('mongodb') diff --git a/aodh/tests/storage/test_impl_sqlalchemy.py b/aodh/tests/functional/storage/test_impl_sqlalchemy.py similarity index 100% rename from aodh/tests/storage/test_impl_sqlalchemy.py rename to aodh/tests/functional/storage/test_impl_sqlalchemy.py diff --git a/aodh/tests/storage/test_storage_scenarios.py b/aodh/tests/functional/storage/test_storage_scenarios.py similarity index 99% rename from aodh/tests/storage/test_storage_scenarios.py rename to aodh/tests/functional/storage/test_storage_scenarios.py index a5e9be27b..c1c048270 100644 --- a/aodh/tests/storage/test_storage_scenarios.py +++ b/aodh/tests/functional/storage/test_storage_scenarios.py @@ -22,7 +22,7 @@ from oslo_utils import timeutils from aodh.storage import models as alarm_models from aodh.tests import constants -from aodh.tests import db as tests_db +from aodh.tests.functional import db as tests_db class DBTestBase(tests_db.TestBase): diff --git a/aodh/tests/functional/test_empty.py b/aodh/tests/functional/test_empty.py deleted file mode 100644 index 043eaa6bd..000000000 --- a/aodh/tests/functional/test_empty.py +++ /dev/null @@ -1,23 +0,0 @@ -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" This test is written to avoid failing running the functional test job -caused by `subunit-trace -f` with empty testr output -in ./tools/pretty-tox.sh""" - -from oslotest import base - - -class TestEmpty(base.BaseTestCase): - def test_empty(self): - pass diff --git a/aodh/tests/storage/sqlalchemy/__init__.py b/aodh/tests/unit/__init__.py similarity index 100% rename from aodh/tests/storage/sqlalchemy/__init__.py rename to aodh/tests/unit/__init__.py diff --git a/aodh/tests/test_bin.py b/aodh/tests/unit/test_bin.py similarity index 100% rename from aodh/tests/test_bin.py rename to aodh/tests/unit/test_bin.py diff --git a/aodh/tests/test_coordination.py b/aodh/tests/unit/test_coordination.py similarity index 100% rename from aodh/tests/test_coordination.py rename to aodh/tests/unit/test_coordination.py diff --git a/aodh/tests/test_evaluator.py b/aodh/tests/unit/test_evaluator.py similarity index 100% rename from aodh/tests/test_evaluator.py rename to aodh/tests/unit/test_evaluator.py diff --git a/aodh/tests/test_event.py b/aodh/tests/unit/test_event.py similarity index 100% rename from aodh/tests/test_event.py rename to aodh/tests/unit/test_event.py diff --git a/aodh/tests/test_messaging.py b/aodh/tests/unit/test_messaging.py similarity index 100% rename from aodh/tests/test_messaging.py rename to aodh/tests/unit/test_messaging.py diff --git a/aodh/tests/test_notifier.py b/aodh/tests/unit/test_notifier.py similarity index 100% rename from aodh/tests/test_notifier.py rename to aodh/tests/unit/test_notifier.py diff --git a/aodh/tests/test_rpc.py b/aodh/tests/unit/test_rpc.py similarity index 100% rename from aodh/tests/test_rpc.py rename to aodh/tests/unit/test_rpc.py diff --git a/aodh/tests/test_utils.py b/aodh/tests/unit/test_utils.py similarity index 100% rename from aodh/tests/test_utils.py rename to aodh/tests/unit/test_utils.py diff --git a/tox.ini b/tox.ini index 448c2989f..8c3f9c57c 100644 --- a/tox.ini +++ b/tox.ini @@ -10,11 +10,10 @@ install_command = pip install -U {opts} {packages} usedevelop = True setenv = VIRTUAL_ENV={envdir} EVENTLET_NO_GREENDNS=yes + OS_TEST_PATH=aodh/tests/unit passenv = OS_TEST_TIMEOUT OS_STDOUT_CAPTURE OS_STDERR_CAPTURE OS_LOG_CAPTURE commands = - bash -x {toxinidir}/setup-test-env-mongodb.sh python setup.py testr --slowest --testr-args="{posargs}" - bash -x {toxinidir}/setup-test-env-mysql.sh python setup.py testr --slowest --testr-args="{posargs}" - bash -x {toxinidir}/setup-test-env-postgresql.sh python setup.py testr --slowest --testr-args="{posargs}" + python setup.py testr --slowest --testr-args="{posargs}" {toxinidir}/generate-config-file.sh whitelist_externals = bash @@ -23,14 +22,17 @@ whitelist_externals = bash # in "py-" jobs [testenv:py27-mongodb] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-mongodb.sh python setup.py testr --slowest --testr-args="{posargs}" [testenv:py27-mysql] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-mysql.sh python setup.py testr --slowest --testr-args="{posargs}" [testenv:py27-pgsql] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-postgresql.sh python setup.py testr --slowest --testr-args="{posargs}" @@ -74,12 +76,18 @@ commands = {posargs} setenv = PYTHONHASHSEED=0 [testenv:debug] +commands = bash -x oslo_debug_helper {posargs} + +[testenv:debug-mongodb] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-mongodb.sh oslo_debug_helper {posargs} [testenv:debug-mysql] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-mysql.sh oslo_debug_helper {posargs} [testenv:debug-pgsql] +setenv = OS_TEST_PATH=aodh/tests/functional/ commands = bash -x {toxinidir}/setup-test-env-postgresql.sh oslo_debug_helper {posargs} [flake8]