mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Try to give the redis container time to fully start up before running the redis cache tests
This commit is contained in:
parent
64fd0cdcb2
commit
afd6e0fdc5
1 changed files with 13 additions and 0 deletions
13
tests/pytests/functional/cache/test_redis.py
vendored
13
tests/pytests/functional/cache/test_redis.py
vendored
|
@ -1,9 +1,11 @@
|
|||
import logging
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from saltfactories.utils import random_string
|
||||
|
||||
import salt.cache
|
||||
from salt.exceptions import SaltCacheError
|
||||
from tests.pytests.functional.cache.helpers import run_common_cache_tests
|
||||
|
||||
pytest.importorskip("redis")
|
||||
|
@ -50,6 +52,17 @@ def cache(minion_opts, redis_container):
|
|||
|
||||
|
||||
def test_caching(subtests, cache):
|
||||
# The container seems to need some time, let's give it some
|
||||
timeout = 20
|
||||
start = time.time()
|
||||
while time.time() < start + timeout:
|
||||
try:
|
||||
cache.contains("fnord")
|
||||
break
|
||||
except SaltCacheError:
|
||||
time.sleep(1)
|
||||
else:
|
||||
pytest.fail("Failed to connect to redis container")
|
||||
run_common_cache_tests(subtests, cache)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue