Skip to content

Commit 49d1b75

Browse files
authored
Merge pull request #368 from TingluoHuang/master
Ignore 'redis.set_repl()' call
2 parents 890a1c8 + 3590c61 commit 49d1b75

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

cmd_scripting_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,17 @@ func TestCmdEvalAuth(t *testing.T) {
495495
func TestLuaReplicate(t *testing.T) {
496496
_, c := runWithClient(t)
497497

498-
mustNil(t, c,
499-
"EVAL", "redis.replicate_commands()", "0",
500-
)
498+
t.Run("replicate_commands", func(t *testing.T) {
499+
mustNil(t, c,
500+
"EVAL", "redis.replicate_commands()", "0",
501+
)
502+
})
503+
504+
t.Run("set_repl", func(t *testing.T) {
505+
mustNil(t, c,
506+
"EVAL", "redis.set_repl(redis.REPL_NONE)", "0",
507+
)
508+
})
501509
}
502510

503511
func TestLuaTX(t *testing.T) {

integration/script_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ func TestScriptReplicate(t *testing.T) {
416416
"EVAL", `redis.replicate_commands();`, "0",
417417
)
418418
})
419+
420+
testRaw(t, func(c *client) {
421+
c.Do(
422+
"EVAL", `redis.set_repl(redis.REPL_NONE);`, "0",
423+
)
424+
})
419425
}
420426

421427
func TestScriptTx(t *testing.T) {

lua.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ func mkLua(srv *server.Server, c *server.Peer, sha string) (map[string]lua.LGFun
161161
// ignored
162162
return 1
163163
},
164+
"set_repl": func(l *lua.LState) int {
165+
top := l.GetTop()
166+
if top != 1 {
167+
l.Error(lua.LString("wrong number of arguments"), 1)
168+
return 0
169+
}
170+
// ignored
171+
return 1
172+
},
164173
}, luaRedisConstants
165174
}
166175

0 commit comments

Comments
 (0)