- 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
62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using NATS.Server.Configuration;
|
|
|
|
namespace NATS.Server.Tests.Gateways;
|
|
|
|
public class GatewayRemoteConfigParityBatch3Tests
|
|
{
|
|
[Fact]
|
|
public void RemoteGatewayOptions_tracks_connection_attempts_and_implicit_flag()
|
|
{
|
|
var cfg = new RemoteGatewayOptions { Name = "GW-B", Implicit = true };
|
|
|
|
cfg.IsImplicit().ShouldBeTrue();
|
|
cfg.GetConnAttempts().ShouldBe(0);
|
|
cfg.BumpConnAttempts().ShouldBe(1);
|
|
cfg.BumpConnAttempts().ShouldBe(2);
|
|
cfg.GetConnAttempts().ShouldBe(2);
|
|
cfg.ResetConnAttempts();
|
|
cfg.GetConnAttempts().ShouldBe(0);
|
|
}
|
|
|
|
[Fact]
|
|
public void RemoteGatewayOptions_add_and_update_urls_normalize_and_deduplicate()
|
|
{
|
|
var cfg = new RemoteGatewayOptions();
|
|
cfg.AddUrls(["127.0.0.1:7222", "nats://127.0.0.1:7222", "nats://127.0.0.1:7223"]);
|
|
|
|
cfg.Urls.Count.ShouldBe(2);
|
|
cfg.Urls.ShouldContain("nats://127.0.0.1:7222");
|
|
cfg.Urls.ShouldContain("nats://127.0.0.1:7223");
|
|
|
|
cfg.UpdateUrls(
|
|
configuredUrls: ["127.0.0.1:7333"],
|
|
discoveredUrls: ["nats://127.0.0.1:7334", "127.0.0.1:7333"]);
|
|
|
|
cfg.Urls.Count.ShouldBe(2);
|
|
cfg.Urls.ShouldContain("nats://127.0.0.1:7333");
|
|
cfg.Urls.ShouldContain("nats://127.0.0.1:7334");
|
|
}
|
|
|
|
[Fact]
|
|
public void RemoteGatewayOptions_save_tls_hostname_and_get_urls_helpers()
|
|
{
|
|
var cfg = new RemoteGatewayOptions
|
|
{
|
|
Urls = ["127.0.0.1:7444", "nats://localhost:7445"],
|
|
};
|
|
|
|
cfg.SaveTlsHostname("nats://gw.example.net:7522");
|
|
cfg.TlsName.ShouldBe("gw.example.net");
|
|
|
|
var urlStrings = cfg.GetUrlsAsStrings();
|
|
urlStrings.Count.ShouldBe(2);
|
|
urlStrings.ShouldContain("nats://127.0.0.1:7444");
|
|
urlStrings.ShouldContain("nats://localhost:7445");
|
|
|
|
var urls = cfg.GetUrls();
|
|
urls.Count.ShouldBe(2);
|
|
urls.ShouldContain(u => u.Authority == "127.0.0.1:7444");
|
|
urls.ShouldContain(u => u.Authority == "localhost:7445");
|
|
}
|
|
}
|