Browse Source

tests: do not skip test on connection error

Change-Id: I50973f8c1dfc2f4ec9b5847784085a0f163845e2
changes/60/138060/2
Julien Danjou 8 years ago
parent
commit
910188e2f8
  1. 4
      setup-memcached-env.sh
  2. 4
      setup-redis-env.sh
  3. 1
      setup-zookeeper-env.sh
  4. 13
      tooz/tests/test_coordination.py

4
setup-memcached-env.sh

@ -19,9 +19,11 @@ if ! check_port 11211; then
if [ -n "$memcached_bin" ]; then
$memcached_bin &
else
echo "Memcached server not available, testing being skipped..."
echo "Memcached server not available"
exit 1
fi
fi
export TOOZ_TEST_MEMCACHED_URL="memcached://?timeout=5"
# Yield execution to venv command
$*

4
setup-redis-env.sh

@ -19,9 +19,11 @@ if ! check_port 6379; then
if [ -n "$redis_bin" ]; then
$redis_bin --port 6379 &
else
echo "Redis server not available, testing being skipped..."
echo "Redis server not available"
exit 1
fi
fi
export TOOZ_TEST_REDIS_URL="redis://localhost:6379?timeout=5"
# Yield execution to venv command
$*

1
setup-zookeeper-env.sh

@ -52,5 +52,6 @@ if ! check_port 2181 && [ -d $ZOO_CONF ]; then
fi
fi
export TOOZ_TEST_ZOOKEEPER_URL="kazoo://127.0.0.1:2181?timeout=5"
# Yield execution to venv command
$*

13
tooz/tests/test_coordination.py

@ -29,13 +29,13 @@ class TestAPI(testscenarios.TestWithScenarios,
tests.TestCaseSkipNotImplemented):
scenarios = [
('zookeeper', {'url': 'kazoo://127.0.0.1:2181?timeout=5',
'bad_url': 'kazoo://localhost:1'}),
('kazoo', {'url': os.getenv("TOOZ_TEST_ZOOKEEPER_URL"),
'bad_url': 'kazoo://localhost:1'}),
('zake', {'url': 'zake://?timeout=5'}),
('memcached', {'url': 'memcached://?timeout=5',
('memcached', {'url': os.getenv("TOOZ_TEST_MEMCACHED_URL"),
'bad_url': 'memcached://localhost:1'}),
('ipc', {'url': 'ipc://'}),
('redis', {'url': 'redis://localhost:6379?timeout=5',
('redis', {'url': os.getenv("TOOZ_TEST_REDIS_URL"),
'bad_url': 'redis://localhost:1'}),
('postgresql', {'url': os.getenv("TOOZ_TEST_PGSQL_URL"),
'bad_url': 'postgresql://localhost:1'}),
@ -75,10 +75,7 @@ class TestAPI(testscenarios.TestWithScenarios,
self.member_id = self._get_random_uuid()
self._coord = tooz.coordination.get_coordinator(self.url,
self.member_id)
try:
self._coord.start()
except tooz.coordination.ToozConnectionError as e:
raise testcase.TestSkipped(str(e))
self._coord.start()
def tearDown(self):
self._coord.stop()

Loading…
Cancel
Save