summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWen Hui <wen.hui.ware@gmail.com>2022-11-24 06:10:41 -0500
committerGitHub <noreply@github.com>2022-11-24 13:10:41 +0200
commit75c66fb02c5df42935322fcf9c53853df1aaad31 (patch)
tree51015bb029afc21422a0833cae78d958d5ea8674
parent3b462ce566e577ffcb35822a0a2372f691326cd4 (diff)
downloadredis-75c66fb02c5df42935322fcf9c53853df1aaad31.tar.gz
Update Sentinel Debug command json file and add test case for it (#11513)
Command SENTINEL DEBUG could be no arguments, which display all configurable arguments and their values. Update the command arguments in the docs (json file) to indicate that arguments are optional
-rw-r--r--src/commands.c2
-rw-r--r--src/commands/sentinel-debug.json1
-rw-r--r--tests/sentinel/tests/14-debug-command.tcl9
3 files changed, 11 insertions, 1 deletions
diff --git a/src/commands.c b/src/commands.c
index e27588ddd..8277e6018 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -3718,7 +3718,7 @@ struct redisCommandArg SENTINEL_DEBUG_data_Subargs[] = {
/* SENTINEL DEBUG argument table */
struct redisCommandArg SENTINEL_DEBUG_Args[] = {
-{"data",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,.subargs=SENTINEL_DEBUG_data_Subargs},
+{"data",ARG_TYPE_BLOCK,-1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE,.subargs=SENTINEL_DEBUG_data_Subargs},
{0}
};
diff --git a/src/commands/sentinel-debug.json b/src/commands/sentinel-debug.json
index 8328c45b8..dac2f6b60 100644
--- a/src/commands/sentinel-debug.json
+++ b/src/commands/sentinel-debug.json
@@ -16,6 +16,7 @@
{
"name": "data",
"type": "block",
+ "optional": true,
"multiple": true,
"arguments": [
{
diff --git a/tests/sentinel/tests/14-debug-command.tcl b/tests/sentinel/tests/14-debug-command.tcl
new file mode 100644
index 000000000..dccb992a9
--- /dev/null
+++ b/tests/sentinel/tests/14-debug-command.tcl
@@ -0,0 +1,9 @@
+source "../tests/includes/init-tests.tcl"
+
+test "Sentinel debug test with arguments and without argument" {
+ set current_info_period [lindex [S 0 SENTINEL DEBUG] 1]
+ S 0 SENTINEL DEBUG info-period 8888
+ assert_equal {8888} [lindex [S 0 SENTINEL DEBUG] 1]
+ S 0 SENTINEL DEBUG info-period $current_info_period
+ assert_equal $current_info_period [lindex [S 0 SENTINEL DEBUG] 1]
+}