From afba8d3c22724b4454d558168a6b96c742003c62 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 22 Mar 2017 14:19:29 +0100 Subject: [PATCH] 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 --- run-tests.sh | 8 ++++++++ tooz/tests/__init__.py | 2 +- tooz/tests/test_coordination.py | 12 ------------ tox.ini | 10 +++++----- 4 files changed, 14 insertions(+), 18 deletions(-) create mode 100755 run-tests.sh diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 00000000..6e448460 --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e +set -x + +for d in $TOOZ_TEST_URLS +do + TOOZ_TEST_URL=$d $* +done diff --git a/tooz/tests/__init__.py b/tooz/tests/__init__.py index e9491033..c9a0bf70 100644 --- a/tooz/tests/__init__.py +++ b/tooz/tests/__init__.py @@ -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() diff --git a/tooz/tests/test_coordination.py b/tooz/tests/test_coordination.py index c177100a..611aa89c 100644 --- a/tooz/tests/test_coordination.py +++ b/tooz/tests/test_coordination.py @@ -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() diff --git a/tox.ini b/tox.ini index f98080a0..40c0c981 100644 --- a/tox.ini +++ b/tox.ini @@ -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}"