test(batch26): port cross-module websocket-dependent tests
This commit is contained in:
@@ -3372,4 +3372,68 @@ public sealed partial class JetStreamFileStoreTests
|
||||
Directory.Delete(root, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact] // T:409
|
||||
public void FileStoreCompactReclaimHeadSpace_ShouldSucceed()
|
||||
{
|
||||
WithStore((fs, root) =>
|
||||
{
|
||||
for (var i = 0; i < 120; i++)
|
||||
fs.StoreMsg("cmp.a", null, new byte[512], 0);
|
||||
|
||||
fs.Compact(80).Error.ShouldBeNull();
|
||||
var state = fs.State();
|
||||
state.FirstSeq.ShouldBeGreaterThanOrEqualTo(80UL);
|
||||
state.Msgs.ShouldBeLessThan(120UL);
|
||||
}, cfg: DefaultStreamConfig(subjects: ["cmp.*"]), fcfg: new FileStoreConfig { BlockSize = 4096 });
|
||||
}
|
||||
|
||||
[Fact] // T:465
|
||||
public void FileStoreTrackSubjLenForPSIM_ShouldSucceed()
|
||||
{
|
||||
WithStore((fs, _) =>
|
||||
{
|
||||
for (var i = 0; i < 40; i++)
|
||||
{
|
||||
fs.StoreMsg($"psim.{i % 4}", null, "x"u8.ToArray(), 0);
|
||||
fs.StoreMsg($"psim.long.subject.{i % 3}", null, "y"u8.ToArray(), 0);
|
||||
}
|
||||
|
||||
var totals = fs.SubjectsTotals("psim.>");
|
||||
totals.Count.ShouldBe(7);
|
||||
totals.Keys.ShouldContain("psim.0");
|
||||
totals.Keys.ShouldContain("psim.long.subject.0");
|
||||
totals["psim.long.subject.0"].ShouldBeGreaterThan(0UL);
|
||||
}, cfg: DefaultStreamConfig(subjects: ["psim.>"]));
|
||||
}
|
||||
|
||||
[Fact] // T:466
|
||||
public void FileStoreLargeFullStatePSIM_ShouldSucceed()
|
||||
{
|
||||
var root = NewRoot();
|
||||
Directory.CreateDirectory(root);
|
||||
|
||||
try
|
||||
{
|
||||
var fs = JetStreamFileStore.NewFileStore(
|
||||
new FileStoreConfig { StoreDir = root, BlockSize = 8192 },
|
||||
DefaultStreamConfig(subjects: ["large.>"]));
|
||||
|
||||
for (var i = 0; i < 300; i++)
|
||||
fs.StoreMsg($"large.{i % 25}", null, new byte[64], 0);
|
||||
|
||||
fs.State().Msgs.ShouldBeGreaterThan(0UL);
|
||||
InvokePrivate<Exception?>(fs, "ForceWriteFullState").ShouldBeNull();
|
||||
|
||||
var stateFile = Path.Combine(root, FileStoreDefaults.MsgDir, FileStoreDefaults.StreamStateFile);
|
||||
File.Exists(stateFile).ShouldBeTrue();
|
||||
new FileInfo(stateFile).Length.ShouldBeGreaterThan(0L);
|
||||
fs.Stop();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(root))
|
||||
Directory.Delete(root, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user