From 0e45ee44f59cc2fbff9b10610ee6a1e2d1749d8a Mon Sep 17 00:00:00 2001 From: Gal Sagie Date: Tue, 8 Dec 2015 08:18:44 +0200 Subject: [PATCH] Separate unit tests from fullstack tests With this patch the tox command only runs the unit tests at the ./kuryr/tests/unit lib. Another test job is added for fullstack which is meant to be run only with a working devstack setup and will run at the gate with tempest. You can run the tests there for debugging with 'tox -e fullstack' implements blueprint: fullstack-testing Change-Id: Ia646b3f1a2b25f0a7fd4d01ed72ea1b51bb3b21c --- .testr.conf | 6 +----- kuryr/tests/fullstack/__init__.py | 0 kuryr/tests/fullstack/test_network.py | 19 +++++++++++++++++++ kuryr/tests/unit/__init__.py | 0 kuryr/tests/{ => unit}/base.py | 0 kuryr/tests/{ => unit}/test_config.py | 4 ++-- kuryr/tests/{ => unit}/test_join.py | 2 +- kuryr/tests/{ => unit}/test_kuryr.py | 2 +- kuryr/tests/{ => unit}/test_kuryr_endpoint.py | 2 +- kuryr/tests/{ => unit}/test_kuryr_network.py | 2 +- kuryr/tests/{ => unit}/test_leave.py | 2 +- kuryr/tests/{ => unit}/test_utils.py | 2 +- tox.ini | 4 ++++ 13 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 kuryr/tests/fullstack/__init__.py create mode 100644 kuryr/tests/fullstack/test_network.py create mode 100644 kuryr/tests/unit/__init__.py rename kuryr/tests/{ => unit}/base.py (100%) rename kuryr/tests/{ => unit}/test_config.py (95%) rename kuryr/tests/{ => unit}/test_join.py (99%) rename kuryr/tests/{ => unit}/test_kuryr.py (99%) rename kuryr/tests/{ => unit}/test_kuryr_endpoint.py (99%) rename kuryr/tests/{ => unit}/test_kuryr_network.py (99%) rename kuryr/tests/{ => unit}/test_leave.py (99%) rename kuryr/tests/{ => unit}/test_utils.py (97%) diff --git a/.testr.conf b/.testr.conf index 4b24f61e..bf048698 100644 --- a/.testr.conf +++ b/.testr.conf @@ -1,8 +1,4 @@ [DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - OS_LOG_CAPTURE=1 \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION +test_command=OS_STDOUT_CAPTURE=1 OS_STDERR_CAPTURE=1 OS_LOG_CAPTURE=1 ${PYTHON:-python} -m subunit.run discover -t ./ ${OS_TEST_PATH:-./kuryr/tests/unit} $LISTOPT $IDOPTION | cat test_id_option=--load-list $IDFILE test_list_option=--list diff --git a/kuryr/tests/fullstack/__init__.py b/kuryr/tests/fullstack/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/kuryr/tests/fullstack/test_network.py b/kuryr/tests/fullstack/test_network.py new file mode 100644 index 00000000..4eedb01f --- /dev/null +++ b/kuryr/tests/fullstack/test_network.py @@ -0,0 +1,19 @@ +# 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. + +from oslotest import base + + +class TestNetwork(base.BaseTestCase): + + def test_something(self): + pass diff --git a/kuryr/tests/unit/__init__.py b/kuryr/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/kuryr/tests/base.py b/kuryr/tests/unit/base.py similarity index 100% rename from kuryr/tests/base.py rename to kuryr/tests/unit/base.py diff --git a/kuryr/tests/test_config.py b/kuryr/tests/unit/test_config.py similarity index 95% rename from kuryr/tests/test_config.py rename to kuryr/tests/unit/test_config.py index 02e40661..338007d9 100644 --- a/kuryr/tests/test_config.py +++ b/kuryr/tests/unit/test_config.py @@ -17,14 +17,14 @@ from neutronclient.common import exceptions as n_exceptions from kuryr.common import config from kuryr.common import exceptions from kuryr import controllers -from kuryr.tests import base +from kuryr.tests.unit import base class ConfigurationTest(base.TestKuryrBase): def test_defaults(self): basepath = os.path.abspath(os.path.join(os.path.dirname(__file__), - '../../')) + '../../../')) self.assertEqual(basepath, config.CONF.pybasedir) self.assertEqual(basepath + '/usr/libexec/kuryr', diff --git a/kuryr/tests/test_join.py b/kuryr/tests/unit/test_join.py similarity index 99% rename from kuryr/tests/test_join.py rename to kuryr/tests/unit/test_join.py index 040d4011..5ed6fb9d 100644 --- a/kuryr/tests/test_join.py +++ b/kuryr/tests/unit/test_join.py @@ -22,7 +22,7 @@ from werkzeug import exceptions as w_exceptions from kuryr import app from kuryr import binding from kuryr.common import exceptions -from kuryr.tests import base +from kuryr.tests.unit import base from kuryr import utils diff --git a/kuryr/tests/test_kuryr.py b/kuryr/tests/unit/test_kuryr.py similarity index 99% rename from kuryr/tests/test_kuryr.py rename to kuryr/tests/unit/test_kuryr.py index 7473b1c7..9845629b 100644 --- a/kuryr/tests/test_kuryr.py +++ b/kuryr/tests/unit/test_kuryr.py @@ -20,7 +20,7 @@ from oslo_serialization import jsonutils from kuryr import app from kuryr.common import config from kuryr.common import constants -from kuryr.tests import base +from kuryr.tests.unit import base from kuryr import utils diff --git a/kuryr/tests/test_kuryr_endpoint.py b/kuryr/tests/unit/test_kuryr_endpoint.py similarity index 99% rename from kuryr/tests/test_kuryr_endpoint.py rename to kuryr/tests/unit/test_kuryr_endpoint.py index d9b19b94..de2b76c6 100644 --- a/kuryr/tests/test_kuryr_endpoint.py +++ b/kuryr/tests/unit/test_kuryr_endpoint.py @@ -20,7 +20,7 @@ from oslo_serialization import jsonutils from kuryr import app from kuryr.common import constants -from kuryr.tests import base +from kuryr.tests.unit import base from kuryr import utils diff --git a/kuryr/tests/test_kuryr_network.py b/kuryr/tests/unit/test_kuryr_network.py similarity index 99% rename from kuryr/tests/test_kuryr_network.py rename to kuryr/tests/unit/test_kuryr_network.py index 3cd11aee..449e92a0 100644 --- a/kuryr/tests/test_kuryr_network.py +++ b/kuryr/tests/unit/test_kuryr_network.py @@ -19,7 +19,7 @@ from neutronclient.common import exceptions from oslo_serialization import jsonutils from kuryr import app -from kuryr.tests import base +from kuryr.tests.unit import base class TestKuryrNetworkCreateFailures(base.TestKuryrFailures): diff --git a/kuryr/tests/test_leave.py b/kuryr/tests/unit/test_leave.py similarity index 99% rename from kuryr/tests/test_leave.py rename to kuryr/tests/unit/test_leave.py index bbf4bb0f..85713a25 100644 --- a/kuryr/tests/test_leave.py +++ b/kuryr/tests/unit/test_leave.py @@ -22,7 +22,7 @@ from werkzeug import exceptions as w_exceptions from kuryr import app from kuryr import binding from kuryr.common import exceptions -from kuryr.tests import base +from kuryr.tests.unit import base from kuryr import utils diff --git a/kuryr/tests/test_utils.py b/kuryr/tests/unit/test_utils.py similarity index 97% rename from kuryr/tests/test_utils.py rename to kuryr/tests/unit/test_utils.py index 57090184..313e3b07 100644 --- a/kuryr/tests/test_utils.py +++ b/kuryr/tests/unit/test_utils.py @@ -15,7 +15,7 @@ import random import ddt -from kuryr.tests import base +from kuryr.tests.unit import base from kuryr import utils diff --git a/tox.ini b/tox.ini index c0953669..d5bf8a4e 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,10 @@ whitelist_externals = sh commands = sh tools/pretty_tox.sh '{posargs}' +[testenv:fullstack] +basepython = python2.7 +setenv = OS_TEST_PATH=./kuryr/tests/fullstack + [testenv:pep8] commands = flake8