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,43 @@
|
||||
// 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 NatsStreamTests
|
||||
{
|
||||
[Fact]
|
||||
public void Create_SetLeader_Purge_AndSeal_ShouldBehave()
|
||||
{
|
||||
var account = new Account { Name = "A" };
|
||||
var streamCfg = new StreamConfig { Name = "ORDERS", Subjects = ["orders.*"], Storage = StorageType.FileStorage };
|
||||
|
||||
var memCfg = streamCfg.Clone();
|
||||
memCfg.Storage = StorageType.MemoryStorage;
|
||||
var store = new JetStreamMemStore(memCfg);
|
||||
store.StoreMsg("orders.new", null, [1, 2], 0);
|
||||
|
||||
var stream = NatsStream.Create(account, streamCfg, null, store, null, null);
|
||||
stream.ShouldNotBeNull();
|
||||
|
||||
stream!.IsLeader().ShouldBeFalse();
|
||||
stream.SetLeader(true, 7);
|
||||
stream.IsLeader().ShouldBeTrue();
|
||||
|
||||
stream.State().Msgs.ShouldBe(1UL);
|
||||
stream.Purge();
|
||||
stream.State().Msgs.ShouldBe(0UL);
|
||||
|
||||
stream.IsSealed().ShouldBeFalse();
|
||||
stream.Seal();
|
||||
stream.IsSealed().ShouldBeTrue();
|
||||
|
||||
stream.GetAccount().Name.ShouldBe("A");
|
||||
stream.GetInfo().Config.Name.ShouldBe("ORDERS");
|
||||
|
||||
stream.Delete();
|
||||
stream.IsLeader().ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user