Skip to content
Merged
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
2 changes: 0 additions & 2 deletions opt/system-setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ def common_last(self):
else:
self.run("%s/bin/getcmake" % READIES)

self.run("{PYTHON} {READIES}/bin/getrmpytools".format(PYTHON=self.python, READIES=READIES))

self.pip_install("-r %s/tests/flow/tests_setup/test_requirements.txt" % ROOT)

self.pip_install("awscli")
Expand Down
12 changes: 6 additions & 6 deletions tests/flow/includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def run_test_multiproc(env, routing_hint, n_procs, fn, args=tuple()):
procs = []

def tmpfn():
con = env.getConnectionByKey(routing_hint, None)
con = env.getConnectionByKey(routing_hint, 'SET')
fn(con, *args)
return 1

Expand All @@ -222,26 +222,26 @@ def load_file_content(file_name):
return f.read()


def check_error_message(env, con, error_msg, *command, error_msg_is_substr=False):
def check_error_message(env, con, error_msg, *command, error_msg_is_substr=False, error_type=redis.exceptions.ResponseError):
try:
con.execute_command(*command)
env.assertFalse(True, message=get_caller_pos())
except Exception as exception:
env.assertEqual(type(exception), redis.exceptions.ResponseError, message=get_caller_pos())
env.assertEqual(type(exception), error_type, message=get_caller_pos())
if error_msg_is_substr:
# We only verify that the given error_msg is a substring of the entire error message.
env.assertTrue(str(exception).find(error_msg) >= 0, message=get_caller_pos())
else:
env.assertEqual(error_msg, str(exception), message=get_caller_pos())


def check_error(env, con, *command):
def check_error(env, con, *command, error_type=redis.exceptions.ResponseError):
try:
con.execute_command(*command)
env.assertFalse(True, message=get_caller_pos())
except Exception as e:
exception = e
env.assertEqual(type(exception), redis.exceptions.ResponseError, message=get_caller_pos())
env.assertTrue(issubclass(type(exception), error_type), message=get_caller_pos())


# Returns a dict with all the fields of a certain section from INFO MODULES command
Expand All @@ -253,4 +253,4 @@ def get_info_section(con, section):


def get_connection(env, routing_hint):
return env.getConnectionByKey(routing_hint, None)
return env.getConnectionByKey(routing_hint, 'SET')
12 changes: 6 additions & 6 deletions tests/flow/tests_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ def test_modelexecute_errors(env):

# The following 2 commands should raise an error on cluster mode (keys are not on the same shard)
if env.isCluster():
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot",
'AI.MODELEXECUTE', 'm{1}', 'INPUTS', 2, 'a{1}', 'b', 'OUTPUTS', 1, 'c{1}')
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot",
'AI.MODELEXECUTE', 'm{1}', 'INPUTS', 2, 'a{1}', 'b{1}', 'OUTPUTS', 1, 'c')
check_error_message(env, con, "Keys in request don't hash to the same slot",
'AI.MODELEXECUTE', 'm{1}', 'INPUTS', 2, 'a{1}', 'b', 'OUTPUTS', 1, 'c{1}', error_type=redis.exceptions.ClusterCrossSlotError)
check_error_message(env, con, "Keys in request don't hash to the same slot",
'AI.MODELEXECUTE', 'm{1}', 'INPUTS', 2, 'a{1}', 'b{1}', 'OUTPUTS', 1, 'c', error_type=redis.exceptions.ClusterCrossSlotError)


def test_keys_syntax(env):
Expand Down Expand Up @@ -319,10 +319,10 @@ def test_pytorch_scriptexecute_errors(env):

if env.isCluster():
# cross shard
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot", 'AI.SCRIPTEXECUTE', 'ket{1}', 'bar', 'KEYS', 1 , '{2}', 'INPUTS', 2, 'a{1}', 'b{1}', 'OUTPUTS', 1, 'c{1}')
check_error_message(env, con, "Keys in request don't hash to the same slot", 'AI.SCRIPTEXECUTE', 'ket{1}', 'bar', 'KEYS', 1 , '{2}', 'INPUTS', 2, 'a{1}', 'b{1}', 'OUTPUTS', 1, 'c{1}', error_type=redis.exceptions.ClusterCrossSlotError)

# key doesn't exist
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot", 'AI.SCRIPTEXECUTE', 'ket{1}', 'bar', 'KEYS', 1 , '{1}', 'INPUTS', 2, 'a{1}', 'b{2}', 'OUTPUTS', 1, 'c{1}')
check_error_message(env, con, "Keys in request don't hash to the same slot", 'AI.SCRIPTEXECUTE', 'ket{1}', 'bar', 'KEYS', 1 , '{1}', 'INPUTS', 2, 'a{1}', 'b{2}', 'OUTPUTS', 1, 'c{1}', error_type=redis.exceptions.ClusterCrossSlotError)


def test_pytorch_scriptexecute_variadic_errors(env):
Expand Down
6 changes: 3 additions & 3 deletions tests/flow/tests_dag_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_dag_crossslot_violation_errors(env):
'PERSIST', '1', 'resultTensor:{2}', '|>',
'AI.TENSORSET', 'resultTensor:{2}', 'FLOAT', 1, 30,
)
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot", *command)
check_error_message(env, con, "Keys in request don't hash to the same slot", *command, error_type=redis.exceptions.ClusterCrossSlotError)

# ERR CROSSSLOT violation (model key has a different hash tag than the LOAD and PERSIST tensors)
command = (
Expand All @@ -224,7 +224,7 @@ def test_dag_crossslot_violation_errors(env):
'INPUTS', 1, 'transactionTensor:{1}',
'OUTPUTS', 1, 'resultTensor:{1}',
)
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot", *command)
check_error_message(env, con, "Keys in request don't hash to the same slot", *command, error_type=redis.exceptions.ClusterCrossSlotError)

command = (
'AI.DAGEXECUTE', 'LOAD', '1', 'referenceTensor:{1}',
Expand All @@ -235,7 +235,7 @@ def test_dag_crossslot_violation_errors(env):
'INPUTS', 1, 'transactionTensor:{1}',
'OUTPUTS', 1, 'resultTensor:{1}',
)
check_error_message(env, con, "CROSSSLOT Keys in request don't hash to the same slot", *command)
check_error_message(env, con, "Keys in request don't hash to the same slot", *command, error_type=redis.exceptions.ClusterCrossSlotError)


def test_dag_tensorget_tensorset_errors(env):
Expand Down
7 changes: 3 additions & 4 deletions tests/flow/tests_setup/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
numpy>=1.19
scikit-image
redis-py-cluster
redisai
redis>=3.0.0
git+https://github.com/Grokzen/redis-py-cluster.git@master
git+https://github.com/RedisLabsModules/RLTest.git@master
redis>=4.1.4
rltest>=0.5.0
ramp-packer>=2.3.0