Skip to content

Commit

Permalink
Support test with redis unstable docker (#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h authored Jan 4, 2022
1 parent 231d402 commit 15f315a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
REDIS_INFO = {}
default_redis_url = "redis://localhost:6379/9"
default_redismod_url = "redis://localhost:36379"
default_redis_unstable_url = "redis://localhost:6378"

# default ssl client ignores verification for the purpose of testing
default_redis_ssl_url = "rediss://localhost:6666"
Expand Down Expand Up @@ -54,6 +55,14 @@ def pytest_addoption(parser):
" defaults to `%(default)s`",
)

parser.addoption(
"--redis-unstable-url",
default=default_redis_unstable_url,
action="store",
help="Redis unstable (latest version) connection string "
"defaults to %(default)s`",
)


def _get_info(redis_url):
client = redis.Redis.from_url(redis_url)
Expand Down Expand Up @@ -357,6 +366,13 @@ def master_host(request):
yield parts.hostname, parts.port


@pytest.fixture()
def unstable_r(request):
url = request.config.getoption("--redis-unstable-url")
with _get_client(redis.Redis, request, from_url=url) as client:
yield client


def wait_for_command(client, monitor, command, key=None):
# issue a command with a key name that's local to this process.
# if we find a command with our key before the command we're waiting
Expand Down

0 comments on commit 15f315a

Please sign in to comment.