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: 1 addition & 1 deletion redis_json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ macro_rules! redis_json_module_create {
commands: [
["json.del", json_command!(json_del), "write", 1,1,1, ACL::Write, ACL::from("json")],
["json.get", json_command!(json_get), "readonly", 1,1,1, ACL::Read, ACL::from("json")],
["json.mget", json_command!(json_mget), "readonly", 1,1,1, ACL::Read, ACL::from("json")],
["json.mget", json_command!(json_mget), "readonly", 1,-2,1, ACL::Read, ACL::from("json")],
["json.set", json_command!(json_set), "write deny-oom", 1,1,1, ACL::Write, ACL::from("json")],
["json.mset", json_command!(json_mset), "write deny-oom", 1,-1,3, ACL::Write, ACL::from("json")],
["json.type", json_command!(json_type), "readonly", 1,1,1, ACL::Read, ACL::from("json")],
Expand Down
2 changes: 1 addition & 1 deletion requierments_docker.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jinja2
addict
toml
ramp-packer==2.5.13
RLTest ~= 0.7.2
RLTest ~= 0.7.29
redis ~= 5.0.8
six >= 1.10.0
gevent >= 22.10.2
2 changes: 1 addition & 1 deletion tests/pytest/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RLTest ~= 0.7.2
RLTest ~= 0.7.29
redis ~= 5.0.8
six >= 1.10.0
gevent >= 22.10.2
Expand Down
15 changes: 12 additions & 3 deletions tests/pytest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ def testSetBSON(env):
r.assertOk(r.execute_command('JSON.SET', 'test', '.', bson, 'FORMAT', 'BSON'))
r.expect('JSON.GET', 'test', *docs['values'].keys()).raiseError()

def testMgetKeySpec(env):
for keys in (["k1"], ["k1", "k2"], ["k1", "k2", "k3"], ["k1", "k2", "k3", "k4"]):
for path in ("$", "$.nested", "."):
env.expect("COMMAND GETKEYS", "JSON.MGET", *keys, path).equal(keys)

info = env.cmd("COMMAND INFO JSON.MGET")[0]
env.assertEqual(info[3:6], [1, -2, 1])


def testMgetCommand(env):
"""Test REJSON.MGET command"""
r = env
Expand Down Expand Up @@ -408,9 +417,9 @@ def testMgetCommand(env):
r.assertEqual(raw[1], None)

# Test that MGET fails on path errors
r.cmd('DEL', 'test')
r.assertOk(r.execute_command('JSON.SET', 'test', '.', '{"bull":4.2}'))
raw = r.execute_command('JSON.MGET', '{doc}:0', 'test', '{doc}:1', '.bool')
r.cmd('DEL', '{doc}:test')
r.assertOk(r.execute_command('JSON.SET', '{doc}:test', '.', '{"bull":4.2}'))
raw = r.execute_command('JSON.MGET', '{doc}:0', '{doc}:test', '{doc}:1', '.bool')
r.assertEqual(len(raw), 3)
r.assertTrue(json.loads(raw[0]))
r.assertEqual(raw[1], None)
Expand Down
2 changes: 1 addition & 1 deletion tests/pytest/test_keyspace_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_keyspace_set(env):
env.assertEqual('["gogototo"]', r.execute_command('JSON.GET', 'test_key', '$.foo'))
env.assertEqual(None, pubsub.get_message(timeout=1))

env.assertEqual(['["gogototo"]', None], r.execute_command('JSON.MGET', 'test_key', 'test_key1', '$.foo'))
env.assertEqual(['["gogototo"]', None], r.execute_command('JSON.MGET', 'test_key', 'test_key1{test_key}', '$.foo'))
env.assertEqual(None, pubsub.get_message(timeout=1))

env.assertEqual([['foo', 'fu', 'mu']], r.execute_command('JSON.OBJKEYS', 'test_key', '$'))
Expand Down
12 changes: 10 additions & 2 deletions tests/pytest/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ setup_coverage() {

run_env() {
if [[ $COORD == oss ]]; then
oss_cluster_args="--env oss-cluster --shards-count $SHARDS"
oss_cluster_args="--env oss-cluster --shards-count $SHARDS $CLUSTER_BUS_ARGS"
RLTEST_ARGS+=" ${oss_cluster_args}"
fi

Expand Down Expand Up @@ -608,6 +608,14 @@ fi

# install_git_lfs

# cluster-bus-port-protected-mode is rejected by a redis that does not have it,
# and a rejected directive stops the server from starting. It exists in redis 8.12
# and up, where it also defaults to enabled and so refuses an unauthenticated
# cluster bus, and in the 8.2.10/8.4.7/8.6.7/8.8.3/8.10.2 backports, where it
# defaults to disabled. Set CLUSTER_BUS_PROTECTED_MODE= to omit it for an older redis.
CLUSTER_BUS_ARGS="--cluster_bus_port_protected_mode ${CLUSTER_BUS_PROTECTED_MODE-no}"
[[ -z ${CLUSTER_BUS_PROTECTED_MODE-no} ]] && CLUSTER_BUS_ARGS=""

#------------------------------------------------------------------------------------- Env only

if [[ $ENV_ONLY == 1 ]]; then
Expand Down Expand Up @@ -637,7 +645,7 @@ if [[ $AOF == 1 ]]; then
{ (RLTEST_ARGS="${RLTEST_ARGS} --use-aof" run_tests "--use-aof"); (( E |= $? )); } || true
fi
if [[ $CLUSTER == 1 ]]; then
{ (RLTEST_ARGS="${RLTEST_ARGS} --env oss-cluster --shards-count 1" run_tests "--env oss-cluster"); (( E |= $? )); } || true
{ (RLTEST_ARGS="${RLTEST_ARGS} --env oss-cluster --shards-count 1 $CLUSTER_BUS_ARGS" run_tests "--env oss-cluster"); (( E |= $? )); } || true
fi

#-------------------------------------------------------------------------------------- Summary
Expand Down
Loading