re-organise tests

organise tests into unit and functional and run tests accordingly

Change-Id: Ibfe95a7d4429a667425f921c97d819f4c04b7aed
This commit is contained in:
gordon chung 2015-09-25 10:49:32 -04:00
parent 8351209970
commit a41aee8518
41 changed files with 34 additions and 44 deletions

View File

@ -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):

View File

@ -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 = [
{

View File

@ -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):

View File

@ -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,

View File

@ -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):

View File

@ -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):

View File

@ -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

View File

@ -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",

View File

@ -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'

View File

@ -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

View File

@ -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):

View File

@ -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,

View File

@ -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')

View File

@ -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):

View File

@ -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

14
tox.ini
View File

@ -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-<backend>" 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]