tests: tests fail if no URL is set + run partitioner tests on basic drivers

This makes sure that the test fails if not URL is set. This allows make sure we
test the non-coordination tests (e.g. partitioner) with all base drives (zake,
ipc, file) by using the TOOZ_TEST_URL to run the tests.

Change-Id: Id500636d166e5ebcc54fda16ef128f91f32170d6
This commit is contained in:
Julien Danjou 2017-03-22 14:19:29 +01:00
parent 85fbf6ca3c
commit afba8d3c22
4 changed files with 14 additions and 18 deletions

8
run-tests.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
set -e
set -x
for d in $TOOZ_TEST_URLS
do
TOOZ_TEST_URL=$d $*
done

View File

@ -56,7 +56,7 @@ class TestWithCoordinator(testcase.TestCase):
def setUp(self):
super(TestWithCoordinator, self).setUp()
if self.url is None:
self.skipTest("No URL set for this driver")
raise RuntimeError("No URL set for this driver")
self.useFixture(fixtures.NestedTempfile())
self.group_id = get_random_uuid()
self.member_id = get_random_uuid()

View File

@ -978,18 +978,6 @@ class TestAPI(tests.TestWithCoordinator):
self.assertTrue(lock.release())
class ZakeTestAPI(TestAPI):
url = "zake://"
class IPCTestAPI(TestAPI):
url = "ipc://"
class FileTestAPI(TestAPI):
url = "file:///tmp"
class TestHook(testcase.TestCase):
def setUp(self):
super(TestHook, self).setUp()

10
tox.ini
View File

@ -14,18 +14,18 @@ deps = .[test,zake,ipc,memcached,mysql,etcd]
mysql: .[mysql]
etcd: .[etcd]
consul: .[consul]
setenv =
TOOZ_TEST_URLS = file:///tmp zake:// ipc://
# NOTE(tonyb): This project has chosen to *NOT* consume upper-constraints.txt
commands = {toxinidir}/tools/pretty_tox.sh "{posargs}"
commands =
{toxinidir}/run-tests.sh {toxinidir}/tools/pretty_tox.sh "{posargs}"
{toxinidir}/run-examples.sh
[testenv:venv]
# This target is used by the gate go run Sphinx to build the doc
deps = .[doc]
commands = {posargs}
[testenv:py27]
commands = {toxinidir}/tools/pretty_tox.sh "{posargs}"
{toxinidir}/run-examples.sh
[testenv:py27-zookeeper]
commands = pifpaf -e TOOZ_TEST run zookeeper -- {toxinidir}/tools/pretty_tox.sh "{posargs}"