Skip to content

Commit fccaaaa

Browse files
committed
fix unit test (bad payload)
1 parent 32987f5 commit fccaaaa

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/StackExchange.Redis/KeyNotification.SubKeys.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ internal SubKeyEnumerator(scoped KeyNotification notification)
204204
{
205205
case KeyNotificationKind.SubKeySpace:
206206
case KeyNotificationKind.SubKeyEvent:
207-
// Payload: <event>|<len>:<subkey>[|<len>:<subkey>...] or <key_len>:<key>|<len>:<subkey>[|<len>:<subkey>...]
208-
// We need to skip to the first | and then iterate through length-prefixed subkeys
207+
// Payload: <event>|<len>:<subkey>,<len>:<subkey>,... or <key_len>:<key>|<len>:<subkey>,<len>:<subkey>,...
208+
// We need to skip to the first | and then iterate through comma-separated length-prefixed subkeys
209209
_data = CopyAndLeaseValue(notification._value, out _lease);
210210

211211
// Find the first pipe to skip the event/key part
@@ -242,7 +242,7 @@ internal SubKeyEnumerator(scoped KeyNotification notification)
242242
break;
243243

244244
case KeyNotificationKind.SubKeySpaceEvent:
245-
// Payload: <len>:<subkey>[|<len>:<subkey>...]
245+
// Payload: <len>:<subkey>,<len>:<subkey>,...
246246
_data = CopyAndLeaseValue(notification._value, out _lease);
247247
_position = 0;
248248
break;

src/StackExchange.Redis/KeyNotification.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ public KeyNotificationType Type
811811
return KeyNotificationTypeMetadata.Parse(ChannelSuffix);
812812

813813
case KeyNotificationKind.SubKeySpace:
814-
// Payload contains <event>|<len>:<subkey>[|<len>:<subkey>...]
814+
// Payload contains <event>|<len>:<subkey>,<len>:<subkey>,...
815815
if (_value.TryGetSpan(out var directSub))
816816
{
817817
var pipeIndexSub = directSub.IndexOf((byte)'|');

tests/StackExchange.Redis.Tests/KeyNotificationTests.cs renamed to tests/StackExchange.Redis.Tests/KeyNotificationUnitTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace StackExchange.Redis.Tests;
99

10-
public class KeyNotificationTests(ITestOutputHelper log)
10+
public class KeyNotificationUnitTests(ITestOutputHelper log)
1111
{
1212
[Theory]
1313
[InlineData("foo", "foo")]
@@ -1677,9 +1677,10 @@ public void SubKeyEvent_RealWorldPayload_ParsesCorrectly()
16771677
[Fact]
16781678
public void SubKeySpace_MultipleFields_ParsesCorrectly()
16791679
{
1680-
// __subkeyspace@0__:mykey with payload "4:hset|6:field1,6:field2"
1680+
// __subkeyspace@0__:mykey with payload "hset|6:field1,6:field2"
1681+
// Format: <event>|<len>:<subkey>,<len>:<subkey>...
16811682
var channel = RedisChannel.Literal("__subkeyspace@0__:mykey");
1682-
RedisValue value = "4:hset|6:field1,6:field2";
1683+
RedisValue value = "hset|6:field1,6:field2";
16831684

16841685
Assert.True(KeyNotification.TryParse(in channel, in value, out var notification));
16851686

0 commit comments

Comments
 (0)