Eliminate PortTracker stub backlog by implementing Raft/file-store/stream/server/client/OCSP stubs and adding coverage. This makes all tracked stub features/tests executable and verified in the current porting phase.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// Copyright 2012-2026 The NATS Authors
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
|
||||
using Shouldly;
|
||||
using ZB.MOM.NatsNet.Server;
|
||||
|
||||
namespace ZB.MOM.NatsNet.Server.Tests.JetStream;
|
||||
|
||||
public sealed class NatsConsumerTests
|
||||
{
|
||||
[Fact]
|
||||
public void Create_SetLeader_UpdateConfig_AndStop_ShouldBehave()
|
||||
{
|
||||
var account = new Account { Name = "A" };
|
||||
var streamCfg = new StreamConfig { Name = "S", Subjects = ["foo"], Storage = StorageType.FileStorage };
|
||||
var stream = NatsStream.Create(account, streamCfg, null, null, null, null);
|
||||
stream.ShouldNotBeNull();
|
||||
|
||||
var cfg = new ConsumerConfig { Durable = "D", AckPolicy = AckPolicy.AckExplicit };
|
||||
var consumer = NatsConsumer.Create(stream!, cfg, ConsumerAction.CreateOrUpdate, null);
|
||||
consumer.ShouldNotBeNull();
|
||||
|
||||
consumer!.IsLeader().ShouldBeFalse();
|
||||
consumer.SetLeader(true, 3);
|
||||
consumer.IsLeader().ShouldBeTrue();
|
||||
|
||||
var updated = new ConsumerConfig { Durable = "D", AckPolicy = AckPolicy.AckAll };
|
||||
consumer.UpdateConfig(updated);
|
||||
consumer.GetConfig().AckPolicy.ShouldBe(AckPolicy.AckAll);
|
||||
|
||||
var info = consumer.GetInfo();
|
||||
info.Stream.ShouldBe("S");
|
||||
info.Name.ShouldBe("D");
|
||||
|
||||
consumer.Stop();
|
||||
consumer.IsLeader().ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user