Files
natsdotnet/tests/NATS.Server.Tests/LeafNodes/LeafSubKeyParityBatch2Tests.cs
Joseph Doherty c30e67a69d Fix E2E test gaps and add comprehensive E2E + parity test suites
- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
  so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
  proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
2026-03-12 14:09:23 -04:00

43 lines
1.5 KiB
C#

using NATS.Server.LeafNodes;
using NATS.Server.Subscriptions;
namespace NATS.Server.Tests.LeafNodes;
public class LeafSubKeyParityBatch2Tests
{
[Fact]
public void Constants_match_go_leaf_key_and_delay_values()
{
LeafSubKey.KeyRoutedSub.ShouldBe("R");
LeafSubKey.KeyRoutedSubByte.ShouldBe((byte)'R');
LeafSubKey.KeyRoutedLeafSub.ShouldBe("L");
LeafSubKey.KeyRoutedLeafSubByte.ShouldBe((byte)'L');
LeafSubKey.SharedSysAccDelay.ShouldBe(TimeSpan.FromMilliseconds(250));
LeafSubKey.ConnectProcessTimeout.ShouldBe(TimeSpan.FromSeconds(2));
}
[Fact]
public void KeyFromSub_matches_go_subject_and_queue_shape()
{
LeafSubKey.KeyFromSub(NewSub("foo")).ShouldBe("foo");
LeafSubKey.KeyFromSub(NewSub("foo", "bar")).ShouldBe("foo bar");
}
[Fact]
public void KeyFromSubWithOrigin_matches_go_routed_and_leaf_routed_shapes()
{
LeafSubKey.KeyFromSubWithOrigin(NewSub("foo")).ShouldBe("R foo");
LeafSubKey.KeyFromSubWithOrigin(NewSub("foo", "bar")).ShouldBe("R foo bar");
LeafSubKey.KeyFromSubWithOrigin(NewSub("foo"), "leaf").ShouldBe("L foo leaf");
LeafSubKey.KeyFromSubWithOrigin(NewSub("foo", "bar"), "leaf").ShouldBe("L foo bar leaf");
}
private static Subscription NewSub(string subject, string? queue = null)
=> new()
{
Subject = subject,
Queue = queue,
Sid = Guid.NewGuid().ToString("N"),
};
}