Move 225 JetStream-related test files from NATS.Server.Tests into a dedicated NATS.Server.JetStream.Tests project. This includes root-level JetStream*.cs files, storage test files (FileStore, MemStore, StreamStoreContract), and the full JetStream/ subfolder tree (Api, Cluster, Consumers, MirrorSource, Snapshots, Storage, Streams). Updated all namespaces, added InternalsVisibleTo, registered in the solution file, and added the JETSTREAM_INTEGRATION_MATRIX define.
34 lines
993 B
C#
34 lines
993 B
C#
using NATS.Server.JetStream.Storage;
|
|
|
|
namespace NATS.Server.JetStream.Tests;
|
|
|
|
public class JetStreamFileStoreLayoutParityTests
|
|
{
|
|
[Fact]
|
|
public async Task File_store_uses_block_index_layout_with_ttl_prune_invariants()
|
|
{
|
|
var dir = Path.Combine(Path.GetTempPath(), $"natsdotnet-filestore-{Guid.NewGuid():N}");
|
|
try
|
|
{
|
|
await using var store = new FileStore(new FileStoreOptions
|
|
{
|
|
Directory = dir,
|
|
BlockSizeBytes = 128,
|
|
MaxAgeMs = 60_000,
|
|
});
|
|
|
|
for (var i = 0; i < 100; i++)
|
|
await store.AppendAsync($"orders.{i}", "x"u8.ToArray(), default);
|
|
|
|
var state = await store.GetStateAsync(default);
|
|
state.Messages.ShouldBe((ulong)100);
|
|
store.BlockCount.ShouldBeGreaterThan(1);
|
|
}
|
|
finally
|
|
{
|
|
if (Directory.Exists(dir))
|
|
Directory.Delete(dir, recursive: true);
|
|
}
|
|
}
|
|
}
|