feat: phase C jetstream depth test parity — 34 new tests across 7 subsystems
Stream lifecycle, publish/ack, consumer delivery, retention policy, API endpoints, cluster formation, and leader failover tests ported from Go nats-server reference. 1006 total tests passing.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using NATS.Server.Configuration;
|
||||
using NATS.Server.JetStream.Models;
|
||||
|
||||
namespace NATS.Server.JetStream.Validation;
|
||||
@@ -20,6 +21,27 @@ public static class JetStreamConfigValidator
|
||||
|
||||
return ValidationResult.Valid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates JetStream cluster configuration requirements.
|
||||
/// When JetStream is enabled and clustering is configured (Cluster.Port > 0),
|
||||
/// both server_name and cluster.name must be set.
|
||||
/// Reference: Go server/jetstream.go validateOptions (line ~2822-2831).
|
||||
/// </summary>
|
||||
public static ValidationResult ValidateClusterConfig(NatsOptions options)
|
||||
{
|
||||
// If JetStream is not enabled or not clustered, no cluster-specific checks needed.
|
||||
if (options.JetStream == null || options.Cluster == null || options.Cluster.Port == 0)
|
||||
return ValidationResult.Valid();
|
||||
|
||||
if (string.IsNullOrEmpty(options.ServerName))
|
||||
return ValidationResult.Invalid("jetstream cluster requires `server_name` to be set");
|
||||
|
||||
if (string.IsNullOrEmpty(options.Cluster.Name))
|
||||
return ValidationResult.Invalid("jetstream cluster requires `cluster.name` to be set");
|
||||
|
||||
return ValidationResult.Valid();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ValidationResult
|
||||
|
||||
Reference in New Issue
Block a user