diff --git a/libs/server/Resp/BasicCommands.cs b/libs/server/Resp/BasicCommands.cs index 0e5406c731..ba2c65fce4 100644 --- a/libs/server/Resp/BasicCommands.cs +++ b/libs/server/Resp/BasicCommands.cs @@ -1463,13 +1463,13 @@ void ProcessHelloCommand(byte? respProtocolVersion, ReadOnlySpan username, this.clientName = clientName; } - (string, string)[] helloResult = + (string, object)[] helloResult = [ ("server", "redis"), ("version", storeWrapper.redisProtocolVersion), ("garnet_version", storeWrapper.version), - ("proto", $"{this.respProtocolVersion}"), - ("id", "63"), + ("proto", this.respProtocolVersion), + ("id", 63), ("mode", storeWrapper.serverOptions.EnableCluster ? "cluster" : "standalone"), ("role", storeWrapper.serverOptions.EnableCluster && storeWrapper.clusterProvider.IsReplica() ? "replica" : "master"), ]; @@ -1488,8 +1488,16 @@ void ProcessHelloCommand(byte? respProtocolVersion, ReadOnlySpan username, { while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item1, ref dcurr, dend)) SendAndReset(); - while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item2, ref dcurr, dend)) - SendAndReset(); + if (helloResult[i].Item2 is int intValue) + { + while (!RespWriteUtils.WriteInteger(intValue, ref dcurr, dend)) + SendAndReset(); + } + else + { + while (!RespWriteUtils.WriteAsciiBulkString(helloResult[i].Item2.ToString(), ref dcurr, dend)) + SendAndReset(); + } } while (!RespWriteUtils.WriteAsciiBulkString("modules", ref dcurr, dend)) SendAndReset(); diff --git a/test/Garnet.test/RespTests.cs b/test/Garnet.test/RespTests.cs index d49c8c48e1..e945a44f71 100644 --- a/test/Garnet.test/RespTests.cs +++ b/test/Garnet.test/RespTests.cs @@ -3420,7 +3420,7 @@ public void AsyncTest1() // We use newline counting for HELLO response as the exact length can vary slightly across versions using var lightClientRequest = TestUtils.CreateRequest(countResponseType: CountResponseType.Newlines); - var expectedNewlineCount = 32; // 32 '\n' characters expected in response + var expectedNewlineCount = 30; // 30 '\n' characters expected in response var response = lightClientRequest.Execute($"hello 3", expectedNewlineCount); ClassicAssert.IsTrue(response.Length is > 180 and < 190);