From 872e49b0b8eae3a346d33e910fea3fb92f6401c5 Mon Sep 17 00:00:00 2001 From: Kostas Kyrimis Date: Sat, 30 Nov 2024 15:53:22 +0100 Subject: [PATCH] fix: command docs (#4229) Signed-off-by: kostas --- src/server/main_service.cc | 3 ++- src/server/server_family_test.cc | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/server/main_service.cc b/src/server/main_service.cc index d8f4c6eb0..938bde4bf 100644 --- a/src/server/main_service.cc +++ b/src/server/main_service.cc @@ -2450,7 +2450,7 @@ void Service::Command(CmdArgList args, Transaction* tx, SinkReplyBuilder* builde return builder->SendLong(cmd_cnt); } - const bool sufficient_args = (args.size() == 2); + bool sufficient_args = (args.size() == 2); // INFO [cmd] if (subcmd == "INFO" && sufficient_args) { @@ -2466,6 +2466,7 @@ void Service::Command(CmdArgList args, Transaction* tx, SinkReplyBuilder* builde return; } + sufficient_args = (args.size() == 1); if (subcmd == "DOCS" && sufficient_args) { return builder->SendOk(); } diff --git a/src/server/server_family_test.cc b/src/server/server_family_test.cc index abeb5317f..accdfc870 100644 --- a/src/server/server_family_test.cc +++ b/src/server/server_family_test.cc @@ -545,4 +545,8 @@ TEST_F(ServerFamilyTest, ConfigNormalization) { RespArray(ElementsAre("replica_priority", "13"))); } +TEST_F(ServerFamilyTest, CommandDocsOk) { + EXPECT_THAT(Run({"command", "docs"}), "OK"); +} + } // namespace dfly