Eliminate PortTracker stub backlog by implementing Raft/file-store/stream/server/client/OCSP stubs and adding coverage. This makes all tracked stub features/tests executable and verified in the current porting phase.

This commit is contained in:
Joseph Doherty
2026-02-27 08:56:26 -05:00
parent ba4f41cf71
commit 8849265780
33 changed files with 2938 additions and 407 deletions

View File

@@ -0,0 +1,62 @@
// Copyright 2012-2026 The NATS Authors
// Licensed under the Apache License, Version 2.0
using System.Reflection;
using Shouldly;
using ZB.MOM.NatsNet.Server;
using ZB.MOM.NatsNet.Server.Internal;
namespace ZB.MOM.NatsNet.Server.Tests.Accounts;
public sealed class ResolverDefaultsOpsTests
{
[Fact]
public async Task ResolverDefaults_StartReloadClose_ShouldBeNoOps()
{
var resolver = new DummyResolver();
resolver.IsReadOnly().ShouldBeTrue();
resolver.IsTrackingUpdate().ShouldBeFalse();
resolver.Start(new object());
resolver.Reload();
resolver.Close();
var jwt = await resolver.FetchAsync("A");
jwt.ShouldBe("jwt");
await Should.ThrowAsync<NotSupportedException>(() => resolver.StoreAsync("A", "jwt"));
}
[Fact]
public void UpdateLeafNodes_SubscriptionDelta_ShouldUpdateMaps()
{
var acc = new Account { Name = "A" };
var sub = new Subscription
{
Subject = System.Text.Encoding.UTF8.GetBytes("foo"),
Queue = System.Text.Encoding.UTF8.GetBytes("q"),
Qw = 2,
};
acc.UpdateLeafNodes(sub, 1);
var rm = (Dictionary<string, int>?)typeof(Account)
.GetField("_rm", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(acc);
rm.ShouldNotBeNull();
rm!["foo"].ShouldBe(1);
var lqws = (Dictionary<string, int>?)typeof(Account)
.GetField("_lqws", BindingFlags.Instance | BindingFlags.NonPublic)!
.GetValue(acc);
lqws.ShouldNotBeNull();
lqws!["foo q"].ShouldBe(2);
}
private sealed class DummyResolver : ResolverDefaultsOps
{
public override Task<string> FetchAsync(string name, CancellationToken ct = default)
=> Task.FromResult("jwt");
}
}