Skip to content

Commit

Permalink
Merge pull request #368 from TingluoHuang/master
Browse files Browse the repository at this point in the history
Ignore 'redis.set_repl()' call
  • Loading branch information
alicebob authored May 12, 2024
2 parents 890a1c8 + 3590c61 commit 49d1b75
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd_scripting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,17 @@ func TestCmdEvalAuth(t *testing.T) {
func TestLuaReplicate(t *testing.T) {
_, c := runWithClient(t)

mustNil(t, c,
"EVAL", "redis.replicate_commands()", "0",
)
t.Run("replicate_commands", func(t *testing.T) {
mustNil(t, c,
"EVAL", "redis.replicate_commands()", "0",
)
})

t.Run("set_repl", func(t *testing.T) {
mustNil(t, c,
"EVAL", "redis.set_repl(redis.REPL_NONE)", "0",
)
})
}

func TestLuaTX(t *testing.T) {
Expand Down
6 changes: 6 additions & 0 deletions integration/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,12 @@ func TestScriptReplicate(t *testing.T) {
"EVAL", `redis.replicate_commands();`, "0",
)
})

testRaw(t, func(c *client) {
c.Do(
"EVAL", `redis.set_repl(redis.REPL_NONE);`, "0",
)
})
}

func TestScriptTx(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ func mkLua(srv *server.Server, c *server.Peer, sha string) (map[string]lua.LGFun
// ignored
return 1
},
"set_repl": func(l *lua.LState) int {
top := l.GetTop()
if top != 1 {
l.Error(lua.LString("wrong number of arguments"), 1)
return 0
}
// ignored
return 1
},
}, luaRedisConstants
}

Expand Down

0 comments on commit 49d1b75

Please sign in to comment.