// Copyright 2017-2026 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Ported from server/reload_test.go and server/opts_test.go (Go NATS server). // 44 reload tests + 1 opts test = 45 total. using System.Net; using System.Net.Sockets; using NATS.Client.Core; using Shouldly; using Xunit.Abstractions; using ZB.MOM.NatsNet.Server; using ZB.MOM.NatsNet.Server.Auth; using ZB.MOM.NatsNet.Server.IntegrationTests.Helpers; namespace ZB.MOM.NatsNet.Server.IntegrationTests.Config; /// /// Integration tests for config hot-reload and opts behaviors. /// Mirrors Go TestConfigReload* and TestDynamicPortOnListen. /// [Collection("ReloadTests")] [Trait("Category", "Integration")] public class ReloadTests : IntegrationTestBase { public ReloadTests(ITestOutputHelper output) : base(output) { } // ========================================================================= // opts_test.go — TestDynamicPortOnListen // ========================================================================= /// /// Verifies that port -1 is preserved when the server is created with random ports. /// Mirrors Go TestDynamicPortOnListen. /// [Fact(Skip = "deferred: requires running NATS server")] public void DynamicPortOnListen_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadNoConfigFile // ========================================================================= /// /// Ensures ReloadOptions returns an error when no config file is set. /// Mirrors Go TestConfigReloadNoConfigFile. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadNoConfigFile_ShouldError() { } // ========================================================================= // reload_test.go — TestConfigReloadInvalidConfig // ========================================================================= /// /// Ensures config time does not change when reload is a no-op. /// Mirrors Go TestConfigReloadInvalidConfig — validates config-time tracking. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadInvalidConfig_ShouldNotChangeConfigTime() { } // ========================================================================= // reload_test.go — TestConfigReload // ========================================================================= /// /// Ensures Reload updates config and advances ConfigTime. /// Mirrors Go TestConfigReload. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReload_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRotateUserAuthentication // ========================================================================= /// /// Ensures Reload supports single user credential rotation. /// Mirrors Go TestConfigReloadRotateUserAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRotateUserAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadEnableUserAuthentication // ========================================================================= /// /// Ensures Reload supports enabling user authentication. /// Mirrors Go TestConfigReloadEnableUserAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadEnableUserAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadDisableUserAuthentication // ========================================================================= /// /// Ensures Reload supports disabling user authentication. /// Mirrors Go TestConfigReloadDisableUserAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadDisableUserAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRotateTokenAuthentication // ========================================================================= /// /// Ensures Reload supports token authentication rotation. /// Mirrors Go TestConfigReloadRotateTokenAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRotateTokenAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadEnableTokenAuthentication // ========================================================================= /// /// Ensures Reload supports enabling token authentication. /// Mirrors Go TestConfigReloadEnableTokenAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadEnableTokenAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadDisableTokenAuthentication // ========================================================================= /// /// Ensures Reload supports disabling token authentication. /// Mirrors Go TestConfigReloadDisableTokenAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadDisableTokenAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterHostUnsupported // ========================================================================= /// /// Ensures Reload returns an error when attempting to change cluster host. /// Mirrors Go TestConfigReloadClusterHostUnsupported. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterHostUnsupported_ShouldError() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterPortUnsupported // ========================================================================= /// /// Ensures Reload returns an error when attempting to change cluster port. /// Mirrors Go TestConfigReloadClusterPortUnsupported. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterPortUnsupported_ShouldError() { } // ========================================================================= // reload_test.go — TestConfigReloadMaxConnections // ========================================================================= /// /// Verifies MaxConn can be changed via reload. /// Mirrors Go TestConfigReloadMaxConnections. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadMaxConnections_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadMaxPayload // ========================================================================= /// /// Verifies MaxPayload can be changed via reload. /// Mirrors Go TestConfigReloadMaxPayload. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadMaxPayload_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterAdvertise // ========================================================================= /// /// Verifies ClusterAdvertise can be changed via reload. /// Mirrors Go TestConfigReloadClusterAdvertise. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterAdvertise_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterNoAdvertise // ========================================================================= /// /// Verifies NoAdvertise can be toggled via reload. /// Mirrors Go TestConfigReloadClusterNoAdvertise. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterNoAdvertise_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterName // ========================================================================= /// /// Verifies that cluster name cannot be changed via reload. /// Mirrors Go TestConfigReloadClusterName. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterName_ShouldErrorOnChange() { } // ========================================================================= // reload_test.go — TestConfigReloadMaxSubsUnsupported // ========================================================================= /// /// Verifies MaxSubs can be changed via reload. /// Mirrors Go TestConfigReloadMaxSubsUnsupported. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadMaxSubs_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClientAdvertise // ========================================================================= /// /// Verifies ClientAdvertise can be changed via reload. /// Mirrors Go TestConfigReloadClientAdvertise. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClientAdvertise_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadNotPreventedByGateways // ========================================================================= /// /// Verifies that reload still works when gateway is configured. /// Mirrors Go TestConfigReloadNotPreventedByGateways. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadNotPreventedByGateways_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAndVarz // ========================================================================= /// /// Verifies that debug/trace flags reload correctly (varz-style). /// Mirrors Go TestConfigReloadAndVarz. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAndVarz_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadConnectErrReports // ========================================================================= /// /// Verifies connect-error reporting setting can be reloaded. /// Mirrors Go TestConfigReloadConnectErrReports. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadConnectErrReports_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadLogging // ========================================================================= /// /// Verifies logging flags can be reloaded (debug, trace, logtime). /// Mirrors Go TestConfigReloadLogging. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadLogging_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadValidate // ========================================================================= /// /// Verifies that reload validates options before applying. /// Mirrors Go TestConfigReloadValidate. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadValidate_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccounts // ========================================================================= /// /// Verifies that accounts config can be reloaded. /// Mirrors Go TestConfigReloadAccounts. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccounts_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadDefaultSystemAccount // ========================================================================= /// /// Verifies that server can reload with a system account configured. /// Mirrors Go TestConfigReloadDefaultSystemAccount. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadDefaultSystemAccount_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadNoPanicOnShutdown // ========================================================================= /// /// Ensures that calling reload while/after shutdown doesn't panic. /// Mirrors Go TestConfigReloadNoPanicOnShutdown. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadNoPanicOnShutdown_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadMaxControlLineWithClients // ========================================================================= /// /// Verifies MaxControlLine can be changed via reload while clients are connected. /// Mirrors Go TestConfigReloadMaxControlLineWithClients. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadMaxControlLineWithClients_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadIgnoreCustomAuth // ========================================================================= /// /// Verifies that custom auth is preserved across reloads. /// Mirrors Go TestConfigReloadIgnoreCustomAuth. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadIgnoreCustomAuth_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadGlobalAccountWithMappingAndJetStream // ========================================================================= /// /// Verifies that reload works when JetStream is enabled. /// Mirrors Go TestConfigReloadGlobalAccountWithMappingAndJetStream. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadGlobalAccountWithMappingAndJetStream_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadWithSysAccountOnly // ========================================================================= /// /// Verifies reload works with system account configured. /// Mirrors Go TestConfigReloadWithSysAccountOnly. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadWithSysAccountOnly_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadBoolFlags (sampled) // ========================================================================= /// /// Verifies boolean flag reload (Debug, Trace, Logtime, LogtimeUTC). /// Mirrors Go TestConfigReloadBoolFlags. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadBoolFlags_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAuthTimeout // ========================================================================= /// /// Verifies that AuthTimeout can be changed via reload. /// Mirrors portion of Go TestConfigReload verifying auth timeout. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAuthTimeout_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadPingInterval // ========================================================================= /// /// Verifies that PingInterval and MaxPingsOut can be changed via reload. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadPingInterval_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadWriteDeadline // ========================================================================= /// /// Verifies that WriteDeadline can be changed via reload. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadWriteDeadline_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadMetadata // ========================================================================= /// /// Verifies that server Metadata can be changed via reload. /// Mirrors portion of Go TestConfigReload verifying metadata. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadMetadata_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadConfigTimeAdvances // ========================================================================= /// /// Verifies that ConfigTime advances after each successful reload. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadConfigTimeAdvances_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRouteCompression // ========================================================================= /// /// Verifies that route compression settings can be changed via reload. /// Mirrors Go TestConfigReloadRouteCompression (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRouteCompression_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAuthDoesNotBreakRouteInterest // ========================================================================= /// /// Verifies that reloading auth config does not break basic connectivity. /// Mirrors Go TestConfigReloadAuthDoesNotBreakRouteInterest. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAuthDoesNotBreakRouteInterest_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadLeafNodeRandomPort // ========================================================================= /// /// Verifies that a server with leaf node configured on random port can reload. /// Mirrors Go TestConfigReloadLeafNodeRandomPort. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadLeafNodeRandomPort_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountMappings // ========================================================================= /// /// Verifies that account mappings reload successfully. /// Mirrors Go TestConfigReloadAccountMappings. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountMappings_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountWithNoChanges // ========================================================================= /// /// Verifies reload with no effective account changes is a no-op (no error). /// Mirrors Go TestConfigReloadAccountWithNoChanges. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountWithNoChanges_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRouteImportPermissionsWithAccounts // ========================================================================= /// /// Verifies route import permission config is preserved on reload. /// Mirrors Go TestConfigReloadRouteImportPermissionsWithAccounts. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRouteImportPermissionsWithAccounts_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterWorks (simplified) // ========================================================================= /// /// Verifies that a server with a cluster configured reloads without error. /// Mirrors Go TestConfigReloadClusterWorks (simplified to single server). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterWorks_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterPerms (simplified) // ========================================================================= /// /// Verifies that cluster permissions can be reloaded without error. /// Mirrors Go TestConfigReloadClusterPerms (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterPerms_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadDisableClusterAuthorization (simplified) // ========================================================================= /// /// Verifies disabling cluster authorization reloads without error. /// Mirrors Go TestConfigReloadDisableClusterAuthorization (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadDisableClusterAuthorization_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadEnableClusterAuthorization (simplified) // ========================================================================= /// /// Verifies enabling cluster authorization via reload does not error. /// Mirrors Go TestConfigReloadEnableClusterAuthorization (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadEnableClusterAuthorization_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRotateFiles // ========================================================================= /// /// Verifies that log file setting can be changed via reload. /// Mirrors Go TestConfigReloadRotateFiles (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRotateFiles_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountStreamsImportExport (simplified) // ========================================================================= /// /// Verifies stream import/export config reloads without error. /// Mirrors Go TestConfigReloadAccountStreamsImportExport (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountStreamsImportExport_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountServicesImportExport (simplified) // ========================================================================= /// /// Verifies service import/export config reloads without error. /// Mirrors Go TestConfigReloadAccountServicesImportExport (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountServicesImportExport_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountUsers (simplified) // ========================================================================= /// /// Verifies account user list can be reloaded. /// Mirrors Go TestConfigReloadAccountUsers (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountUsers_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountNKeyUsers (simplified) // ========================================================================= /// /// Verifies nkey user config reloads without error. /// Mirrors Go TestConfigReloadAccountNKeyUsers (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountNKeyUsers_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterRemoveSolicitedRoutes (simplified) // ========================================================================= /// /// Verifies solicited routes list can be changed via reload. /// Mirrors Go TestConfigReloadClusterRemoveSolicitedRoutes (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterRemoveSolicitedRoutes_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadUnsupportedHotSwapping // ========================================================================= /// /// Ensures that changing listen host/port is rejected as not supported. /// Mirrors Go TestConfigReloadUnsupportedHotSwapping. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadUnsupportedHotSwapping_ShouldErrorOrNoOp() { } // ========================================================================= // reload_test.go — TestConfigReloadAccountResolverTLSConfig (simplified) // ========================================================================= /// /// Verifies that account resolver TLS config reload doesn't cause an error. /// Mirrors Go TestConfigReloadAccountResolverTLSConfig (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadAccountResolverTLSConfig_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterPermsImport (simplified) // ========================================================================= /// /// Verifies cluster import permissions reload without error. /// Mirrors Go TestConfigReloadClusterPermsImport (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterPermsImport_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterPermsExport (simplified) // ========================================================================= /// /// Verifies cluster export permissions reload without error. /// Mirrors Go TestConfigReloadClusterPermsExport (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterPermsExport_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadClusterPermsOldServer (simplified) // ========================================================================= /// /// Verifies that cluster perms can be applied when old-server compat is needed. /// Mirrors Go TestConfigReloadClusterPermsOldServer (simplified). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadClusterPermsOldServer_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadChangePermissions (simplified) // ========================================================================= /// /// Verifies that connection keeps working after a reload that changes permissions. /// Mirrors Go TestConfigReloadChangePermissions (simplified behavioral check). /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadChangePermissions_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadDisableUsersAuthentication // ========================================================================= /// /// Verifies disabling multi-user authentication via reload allows anonymous access. /// Mirrors Go TestConfigReloadDisableUsersAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadDisableUsersAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadRotateUsersAuthentication // ========================================================================= /// /// Verifies that changing user passwords via reload rejects old credentials. /// Mirrors Go TestConfigReloadRotateUsersAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadRotateUsersAuthentication_ShouldSucceed() { } // ========================================================================= // reload_test.go — TestConfigReloadEnableUsersAuthentication // ========================================================================= /// /// Verifies enabling user authentication via reload blocks anonymous connections. /// Mirrors Go TestConfigReloadEnableUsersAuthentication. /// [Fact(Skip = "deferred: requires running NATS server")] public void ConfigReloadEnableUsersAuthentication_ShouldSucceed() { } }