- Rename tests/NATS.Server.Tests -> tests/NATS.Server.Core.Tests - Update solution file, InternalsVisibleTo, and csproj references - Remove JETSTREAM_INTEGRATION_MATRIX and NATS.NKeys from csproj (moved to JetStream.Tests and Auth.Tests) - Update all namespaces from NATS.Server.Tests.* to NATS.Server.Core.Tests.* - Replace private GetFreePort/ReadUntilAsync helpers with TestUtilities calls - Fix stale namespace in Transport.Tests/NetworkingGoParityTests.cs
76 lines
4.0 KiB
C#
76 lines
4.0 KiB
C#
using NATS.Server;
|
|
using NATS.Server.Protocol;
|
|
|
|
namespace NATS.Server.Core.Tests.ProtocolParity;
|
|
|
|
public class ProtocolDefaultConstantsGapParityTests
|
|
{
|
|
[Fact]
|
|
public void NatsProtocol_exposes_core_default_constants()
|
|
{
|
|
NatsProtocol.DefaultHost.ShouldBe("0.0.0.0");
|
|
NatsProtocol.DefaultHttpPort.ShouldBe(8222);
|
|
NatsProtocol.DefaultHttpBasePath.ShouldBe("/");
|
|
NatsProtocol.DefaultRoutePoolSize.ShouldBe(3);
|
|
NatsProtocol.DefaultLeafNodePort.ShouldBe(7422);
|
|
NatsProtocol.MaxPayloadMaxSize.ShouldBe(8 * 1024 * 1024);
|
|
NatsProtocol.DefaultMaxConnections.ShouldBe(64 * 1024);
|
|
NatsProtocol.DefaultPingMaxOut.ShouldBe(2);
|
|
NatsProtocol.DefaultMaxClosedClients.ShouldBe(10_000);
|
|
NatsProtocol.DefaultConnectErrorReports.ShouldBe(3600);
|
|
NatsProtocol.DefaultReconnectErrorReports.ShouldBe(1);
|
|
NatsProtocol.DefaultAllowResponseMaxMsgs.ShouldBe(1);
|
|
NatsProtocol.DefaultServiceLatencySampling.ShouldBe(100);
|
|
NatsProtocol.DefaultSystemAccount.ShouldBe("$SYS");
|
|
NatsProtocol.DefaultGlobalAccount.ShouldBe("$G");
|
|
NatsProtocol.ProtoSnippetSize.ShouldBe(32);
|
|
NatsProtocol.MaxControlLineSnippetSize.ShouldBe(128);
|
|
}
|
|
|
|
[Fact]
|
|
public void NatsProtocol_exposes_core_default_timespans()
|
|
{
|
|
NatsProtocol.TlsTimeout.ShouldBe(TimeSpan.FromSeconds(2));
|
|
NatsProtocol.DefaultTlsHandshakeFirstFallbackDelay.ShouldBe(TimeSpan.FromMilliseconds(50));
|
|
NatsProtocol.AuthTimeout.ShouldBe(TimeSpan.FromSeconds(2));
|
|
NatsProtocol.DefaultRouteConnect.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultRouteConnectMax.ShouldBe(TimeSpan.FromSeconds(30));
|
|
NatsProtocol.DefaultRouteReconnect.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultRouteDial.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultLeafNodeReconnect.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultLeafTlsTimeout.ShouldBe(TimeSpan.FromSeconds(2));
|
|
NatsProtocol.DefaultLeafNodeInfoWait.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultRttMeasurementInterval.ShouldBe(TimeSpan.FromHours(1));
|
|
NatsProtocol.DefaultAllowResponseExpiration.ShouldBe(TimeSpan.FromMinutes(2));
|
|
NatsProtocol.DefaultServiceExportResponseThreshold.ShouldBe(TimeSpan.FromMinutes(2));
|
|
NatsProtocol.DefaultAccountFetchTimeout.ShouldBe(TimeSpan.FromMilliseconds(1900));
|
|
NatsProtocol.DefaultPingInterval.ShouldBe(TimeSpan.FromMinutes(2));
|
|
NatsProtocol.DefaultFlushDeadline.ShouldBe(TimeSpan.FromSeconds(10));
|
|
NatsProtocol.AcceptMinSleep.ShouldBe(TimeSpan.FromMilliseconds(10));
|
|
NatsProtocol.AcceptMaxSleep.ShouldBe(TimeSpan.FromSeconds(1));
|
|
NatsProtocol.DefaultLameDuckDuration.ShouldBe(TimeSpan.FromMinutes(2));
|
|
NatsProtocol.DefaultLameDuckGracePeriod.ShouldBe(TimeSpan.FromSeconds(10));
|
|
}
|
|
|
|
[Fact]
|
|
public void NatsOptions_defaults_are_bound_to_protocol_defaults()
|
|
{
|
|
var options = new NatsOptions();
|
|
|
|
options.Host.ShouldBe(NatsProtocol.DefaultHost);
|
|
options.Port.ShouldBe(NatsProtocol.DefaultPort);
|
|
options.MaxConnections.ShouldBe(NatsProtocol.DefaultMaxConnections);
|
|
options.AuthTimeout.ShouldBe(NatsProtocol.AuthTimeout);
|
|
options.PingInterval.ShouldBe(NatsProtocol.DefaultPingInterval);
|
|
options.MaxPingsOut.ShouldBe(NatsProtocol.DefaultPingMaxOut);
|
|
options.WriteDeadline.ShouldBe(NatsProtocol.DefaultFlushDeadline);
|
|
options.TlsTimeout.ShouldBe(NatsProtocol.TlsTimeout);
|
|
options.TlsHandshakeFirstFallback.ShouldBe(NatsProtocol.DefaultTlsHandshakeFirstFallbackDelay);
|
|
options.MaxClosedClients.ShouldBe(NatsProtocol.DefaultMaxClosedClients);
|
|
options.LameDuckDuration.ShouldBe(NatsProtocol.DefaultLameDuckDuration);
|
|
options.LameDuckGracePeriod.ShouldBe(NatsProtocol.DefaultLameDuckGracePeriod);
|
|
options.ConnectErrorReports.ShouldBe(NatsProtocol.DefaultConnectErrorReports);
|
|
options.ReconnectErrorReports.ShouldBe(NatsProtocol.DefaultReconnectErrorReports);
|
|
}
|
|
}
|