Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specification of decode_responses in Env #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RLTest/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def getKwargs(self):
class Env:
RTestInstance = None
EnvCompareParams = ['module', 'moduleArgs', 'env', 'useSlaves', 'shardsCount', 'useAof',
'useRdbPreamble', 'forceTcp']
'useRdbPreamble', 'forceTcp', 'decodeResponses']
Copy link
Collaborator

@MeirShpilraien MeirShpilraien Aug 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it should be part of the env definition, we could make it an argument to env.cmd/env.expect/env.getConnection .. WDYT?


def compareEnvs(self, env):
if env is None:
Expand Down Expand Up @@ -182,7 +182,7 @@ def __init__(self, testName=None, testDescription=None, module=None,
self.env = env if env else Defaults.env
self.useSlaves = useSlaves if useSlaves else Defaults.use_slaves
self.shardsCount = shardsCount if shardsCount else Defaults.num_shards
self.decodeResponses = decodeResponses if decodeResponses else Defaults.decode_responses
self.decodeResponses = decodeResponses if decodeResponses is not None else Defaults.decode_responses
self.useAof = useAof if useAof else Defaults.use_aof
self.useRdbPreamble = useRdbPreamble if useRdbPreamble is not None else Defaults.use_rdb_preamble
self.verbose = Defaults.verbose
Expand Down
7 changes: 4 additions & 3 deletions RLTest/exists_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@


class ExistsRedisEnv(object):
def __init__(self, addr='localhost:6379', password = None, **kargs):
def __init__(self, addr='localhost:6379', password = None, decodeResponses=False, **kargs):
self.host, self.port = addr.split(':')
self.port = int(self.port)
self.password = password
self.decodeResponses = decodeResponses

@property
def has_interactive_debugger(self):
Expand All @@ -36,7 +37,7 @@ def stopEnv(self, masters = True, slaves = True):
pass

def getConnection(self, shardId=1):
return redis.StrictRedis(self.host, self.port, password=self.password)
return redis.StrictRedis(self.host, self.port, password=self.password, decode_responses=self.decodeResponses)

def getSlaveConnection(self):
raise Exception('asked for slave connection but no slave exists')
Expand All @@ -63,7 +64,7 @@ def _waitForBgsaveToFinish(self):
while True:
if not self.getConnection().execute_command('info', 'Persistence')['rdb_bgsave_in_progress']:
break

def flush(self):
self.getConnection().flushall()
self._waitForBgsaveToFinish()
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "RLTest"
version = "0.4.2"
version = "0.4.4"
description="Redis Labs Test Framework, allow to run tests on redis and modules on a variety of environments"
authors = ["RedisLabs <[email protected]>"]
license = "BSD-3-Clause"
Expand All @@ -25,7 +25,8 @@ classifiers = [
[tool.poetry.dependencies]
python = "^2.7,<2.8 || >= 3.5.0"
distro = "^1.5.0"
redis = "^3.5.3"
# redis = "^3.5.3"
redis = { git = "https://github.com/redisfab/redis-py.git", branch = "3.5" }
redis-py-cluster = "*"
psutil = "^5.8.0"
pytest-cov = "2.5"
Expand Down