Skip to content

Commit f75aeeb

Browse files
committed
fix broken test
1 parent a9305cd commit f75aeeb

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/StackExchange.Redis/ClientInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ private sealed class ClientInfoProcessor : ResultProcessor<ClientInfo[]>
292292
{
293293
protected override bool SetResultCore(PhysicalConnection connection, Message message, ref RespReader reader)
294294
{
295-
if (reader.IsScalar)
295+
if (reader.Prefix is RespPrefix.BulkString or RespPrefix.VerbatimString)
296296
{
297297
var raw = reader.ReadString();
298298
if (TryParse(raw, out var clients))

tests/StackExchange.Redis.Tests/ResultProcessorUnitTests/ClientInfo.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,25 @@ public void NotBulkString_Failure()
6969

7070
ExecuteUnexpected(resp, StackExchange.Redis.ClientInfo.Processor);
7171
}
72+
73+
[Fact]
74+
public void VerbatimString_Success()
75+
{
76+
// Verbatim string with TXT encoding - should behave identically to bulk string
77+
// Format: ={len}\r\n{enc}:{payload}\r\n where enc is exactly 3 bytes (e.g., "TXT")
78+
var content = "id=86 addr=172.17.0.1:40750 laddr=172.17.0.2:3000 fd=22 name= age=7 idle=0 flags=N db=0 sub=0 psub=0 ssub=0 multi=-1 watch=0 qbuf=26 qbuf-free=20448 argv-mem=10 multi-mem=0 rbs=1024 rbp=0 obl=0 oll=0 omem=0 tot-mem=22810 events=r cmd=client|list user=default redir=-1 resp=2 lib-name= lib-ver= io-thread=0 tot-net-in=48 tot-net-out=36 tot-cmds=0\n";
79+
var totalLen = 4 + content.Length; // "TXT:" + content
80+
var resp = $"={totalLen}\r\nTXT:{content}\r\n";
81+
82+
var result = Execute(resp, StackExchange.Redis.ClientInfo.Processor);
83+
84+
// ReadString() automatically strips the "TXT:" encoding prefix,
85+
// so the result should be identical to the bulk string test
86+
Assert.NotNull(result);
87+
Assert.Single(result);
88+
Assert.Equal(86, result[0].Id);
89+
Assert.Equal("172.17.0.1:40750", result[0].Address?.ToString());
90+
Assert.Equal(7, result[0].AgeSeconds);
91+
Assert.Equal(0, result[0].Database);
92+
}
7293
}

0 commit comments

Comments
 (0)