fix: resolve 19 JetStream test failures across 5 root causes
- HandleList: populate StreamNames/ConsumerNames alongside info lists - ValidateConfigUpdate: allow clearing mirror/sources, accept even replicas - ToWireFormat: add AccountInfo branch for $JS.API.INFO responses - UpdateStream fixture: preserve existing retention policy on update - Integration test: fix assertion to match valid account info response
This commit is contained in:
@@ -278,10 +278,10 @@ public class ConfigUpdateValidationTests
|
||||
errors.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
// Go ref: server/stream.go — RAFT consensus requires an odd number of replicas.
|
||||
// Setting replicas to an even number must be rejected.
|
||||
// Go ref: server/stream.go — Go server supports even replica counts (e.g., R2).
|
||||
// Even replicas should be accepted by config update validation.
|
||||
[Fact]
|
||||
public void ValidateConfigUpdate_rejects_even_replicas()
|
||||
public void ValidateConfigUpdate_accepts_even_replicas()
|
||||
{
|
||||
var existing = new StreamConfig
|
||||
{
|
||||
@@ -300,7 +300,7 @@ public class ConfigUpdateValidationTests
|
||||
|
||||
var errors = StreamManager.ValidateConfigUpdate(existing, proposed);
|
||||
|
||||
errors.ShouldContain(e => e.Contains("replicas must be odd"));
|
||||
errors.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
// Go ref: server/stream.go:1500-1600 (stream.update) — integration via StreamManager.
|
||||
|
||||
@@ -12,7 +12,7 @@ public class JetStreamApiProtocolIntegrationTests
|
||||
await using var server = await ServerFixture.StartJetStreamEnabledAsync();
|
||||
var response = await server.RequestAsync("$JS.API.INFO", "{}", timeoutMs: 1000);
|
||||
|
||||
response.ShouldContain("\"error\"");
|
||||
response.ShouldContain("\"streams\"");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,13 +121,22 @@ public sealed class JetStreamClusterFixture : IAsyncDisposable
|
||||
/// Go ref: updateStream in jetstream_helpers_test.go.
|
||||
/// </summary>
|
||||
public JetStreamApiResponse UpdateStream(string name, string[] subjects, int replicas, int maxMsgs = 0)
|
||||
=> _streamManager.CreateOrUpdate(new StreamConfig
|
||||
{
|
||||
// Preserve the existing stream's retention policy so ValidateConfigUpdate
|
||||
// does not reject the update for changing an immutable field.
|
||||
var retention = RetentionPolicy.Limits;
|
||||
if (_streamManager.TryGet(name, out var existing))
|
||||
retention = existing.Config.Retention;
|
||||
|
||||
return _streamManager.CreateOrUpdate(new StreamConfig
|
||||
{
|
||||
Name = name,
|
||||
Subjects = [.. subjects],
|
||||
Replicas = replicas,
|
||||
MaxMsgs = maxMsgs,
|
||||
Retention = retention,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the full stream info response.
|
||||
|
||||
Reference in New Issue
Block a user