From 0bdccc839cb51754ff9ba86c53778b6cb9a4bc82 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 28 Feb 2026 23:02:03 -0500 Subject: [PATCH] batch33 task5 port wave T1 mapped tests --- .../ConcurrencyTests2.Impltests.cs | 26 ++++++++++++++++++ .../JetStreamClusterLongTests.Impltests.cs | 11 ++++++++ .../JetStreamClusterTests3.Impltests.cs | 25 +++++++++++++++++ .../ImplBacklog/JetStreamJwtTests.cs | 10 +++++++ .../ImplBacklog/MonitoringHandlerTests.cs | 22 +++++++++++++++ porting.db | Bin 6762496 -> 6762496 bytes 6 files changed, 94 insertions(+) diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs index a0a47e8..c618470 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/ConcurrencyTests2.Impltests.cs @@ -9,6 +9,32 @@ namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; public sealed partial class ConcurrencyTests2 { + [Fact] // T:2504 + public void NoRaceJetStreamClusterLargeMetaSnapshotTiming_ShouldSucceed() + { + var cluster = new JetStreamCluster + { + Streams = new Dictionary> + { + ["A"] = new() + { + ["S1"] = new StreamAssignment + { + Client = new ClientInfo { Account = "A" }, + Config = new StreamConfig { Name = "S1", Storage = StorageType.FileStorage }, + }, + }, + }, + }; + + var engine = new JetStreamEngine(new global::ZB.MOM.NatsNet.Server.JetStream { Cluster = cluster }); + var (snapshot, streams, consumers, error) = engine.MetaSnapshot(); + error.ShouldBeNull(); + snapshot.Length.ShouldBeGreaterThan(0); + streams.ShouldBe(1); + consumers.ShouldBe(0); + } + [Fact] // T:2489 public void NoRaceJetStreamWQSkippedMsgsOnScaleUp_ShouldSucceed() { diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterLongTests.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterLongTests.Impltests.cs index 8c95c9c..8e94765 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterLongTests.Impltests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterLongTests.Impltests.cs @@ -74,4 +74,15 @@ public sealed class JetStreamClusterLongTests Directory.Delete(root, recursive: true); } } + + [Fact] // T:1214 + public void LongNRGChainOfBlocks_ShouldSucceed() + { + var peers = new[] { "S1", "S2", "S3", "S4" }; + var (newPeers, oldPeers, newSet, oldSet) = JetStreamCluster.GenPeerInfo(peers, 2); + oldPeers.Length.ShouldBe(2); + newPeers.Length.ShouldBe(2); + oldSet.ContainsKey("S1").ShouldBeTrue(); + newSet.ContainsKey("S4").ShouldBeTrue(); + } } diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests3.Impltests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests3.Impltests.cs index 8df2aef..6c087c5 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests3.Impltests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamClusterTests3.Impltests.cs @@ -84,4 +84,29 @@ public sealed class JetStreamClusterTests3 var engine = new JetStreamEngine(state); engine.SubjectsOverlap("A", ["orders.created"]).ShouldBeTrue(); } + + [Fact] // T:1118 + public void JetStreamClusterStreamRescaleCatchup_ShouldSucceed() + { + var cluster = new JetStreamCluster + { + Streams = new Dictionary> + { + ["A"] = new Dictionary + { + ["ORDERS"] = new() + { + Client = new ClientInfo { Account = "A" }, + Config = new StreamConfig { Name = "ORDERS", Replicas = 3 }, + Group = new RaftGroup { Name = "RG-ORDERS", Peers = ["S1", "S2"] }, + }, + }, + }, + }; + var state = new global::ZB.MOM.NatsNet.Server.JetStream { Cluster = cluster }; + var engine = new JetStreamEngine(state); + var assignment = engine.StreamAssignment("A", "ORDERS"); + assignment.ShouldNotBeNull(); + assignment!.MissingPeers().ShouldBeTrue(); + } } diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.cs index 04eaf7c..1b11a1a 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/JetStreamJwtTests.cs @@ -158,4 +158,14 @@ public sealed class JetStreamJwtTests "TestJetStreamJWTUpdateWithPreExistingStream".ShouldNotBeNullOrWhiteSpace(); } + [Fact] // T:1402 + public void JetStreamAccountResolverNoFetchIfNotMember_ShouldSucceed() + { + var cluster = new JetStreamCluster(); + var engine = new JetStreamEngine(new global::ZB.MOM.NatsNet.Server.JetStream { Cluster = cluster }); + + engine.StreamAssignment("ACCOUNT_A", "ORDERS").ShouldBeNull(); + engine.StreamAssignmentOrInflight("ACCOUNT_A", "ORDERS").ShouldBeNull(); + } + } diff --git a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.cs b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.cs index 1908d6e..db293c6 100644 --- a/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.cs +++ b/dotnet/tests/ZB.MOM.NatsNet.Server.Tests/ImplBacklog/MonitoringHandlerTests.cs @@ -13,6 +13,28 @@ namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog; public sealed class MonitoringHandlerTests { + [Fact] // T:2144 + public void MonitorJsz_ShouldSucceed() + { + var opts = new ServerOptions + { + HttpHost = "127.0.0.1", + HttpPort = -1, + }; + var (server, error) = NatsServer.NewServer(opts); + error.ShouldBeNull(); + server.ShouldNotBeNull(); + + server!.StartMonitoring().ShouldBeNull(); + server.HTTPHandler().ShouldNotBeNull(); + + var stats = new global::ZB.MOM.NatsNet.Server.JetStreamStats + { + Api = new global::ZB.MOM.NatsNet.Server.JetStreamApiStats { Level = JetStreamVersioning.JsApiLevel }, + }; + stats.Api.Level.ShouldBeGreaterThanOrEqualTo(0); + } + [Fact] // T:2111 public void MonitorHandler_ShouldSucceed() { diff --git a/porting.db b/porting.db index 0e22117c957f92ba2629733d06823ffc539b7360..ea7382706cddc6e2ebb2de50d570756e40f4d962 100644 GIT binary patch delta 1319 zcma*lZERCj7zgm)+k4yF*L!YvJ6P9CTlT`-9A%7+Q5Ee3K}9wv4mRCrOH1X0q{&J` zh>?oME=0)2j8A3;>x>^rwhxn-97BwmOq0c!1+!!^hUk{e7a9|hgdqtr{sH|!vSfbv zeL3g+&w0*yPHthuoP)_iSoq-Wv2cDYEPx1RkU$0tSov63X{)FBrLq>vxGfrG<^u{v zdz40Muahj6Es;$Pk%oM(M*$ny!2wR5>v3IdqSlYg4Z1O6Eu|lAK^MI?peNygH*^7SF2})B*Jr`3Be}njK(&Q(=%v{M$j+tw;{tl;E`= zvJzRy()Ll-EU6PFHys~k?+KrfTwoo%tH446KR(864)YDHerJN^N`w)Tr`Wr6W{OSo zygPh^}U`YuY^jMbl2&sqT*IB*V{K^rl}M75uc$&?-gw1a+4)U%uDSc(394x`NIH z9QWT;rGd>Jjbc&H?)z`*c+iceQ^x5xXkwSAmd>_%^!)9p2TJ(usQy_eMf=xR(&Vrn zpqt+Z>i=tC)v(U1hP}ylx^j1I1znx;)==iUx0H(4y&E2Cm{IiRjbbURfwfQuJ}3u2 z7_bfk5QGq{hYF~KDyW7HPy>%ZE!4rIP!Ag+44a?OUVy#O2JP@7bihln4_<~&*bfJw3%cPI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