mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
fix(cluster): Fix crash when getting DFLYCLUSTER GETSLOTINFO
with no other args. (#1351)
This commit is contained in:
parent
9ab70e4f15
commit
7dcdeee1bb
2 changed files with 9 additions and 1 deletions
|
@ -434,7 +434,7 @@ void ClusterFamily::DflyClusterConfig(CmdArgList args, ConnectionContext* cntx)
|
|||
}
|
||||
|
||||
void ClusterFamily::DflyClusterGetSlotInfo(CmdArgList args, ConnectionContext* cntx) {
|
||||
if (args.size() == 2) {
|
||||
if (args.size() <= 2) {
|
||||
return (*cntx)->SendError(facade::WrongNumArgsError("DFLYCLUSTER GETSLOTINFO"), kSyntaxErrType);
|
||||
}
|
||||
ToUpper(&args[1]);
|
||||
|
|
|
@ -430,6 +430,14 @@ TEST_F(ClusterFamilyTest, ClusterConfigFullMultipleInstances) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_F(ClusterFamilyTest, ClusterGetSlotInfoInvalid) {
|
||||
constexpr string_view kTooFewArgs =
|
||||
"ERR wrong number of arguments for 'dflycluster getslotinfo' command";
|
||||
EXPECT_THAT(RunAdmin({"dflycluster", "getslotinfo"}), ErrArg(kTooFewArgs));
|
||||
EXPECT_THAT(RunAdmin({"dflycluster", "getslotinfo", "s"}), ErrArg(kTooFewArgs));
|
||||
EXPECT_THAT(RunAdmin({"dflycluster", "getslotinfo", "slots"}), ErrArg(kTooFewArgs));
|
||||
}
|
||||
|
||||
TEST_F(ClusterFamilyTest, ClusterGetSlotInfo) {
|
||||
string config_template = R"json(
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue