feat(batch15): complete group 4 msgblock/consumerfilestore
This commit is contained in:
@@ -7,6 +7,46 @@ namespace ZB.MOM.NatsNet.Server.Tests.ImplBacklog;
|
||||
|
||||
public sealed partial class ConcurrencyTests1
|
||||
{
|
||||
[Fact] // T:2422
|
||||
public void NoRaceJetStreamConsumerFileStoreConcurrentDiskIO_ShouldSucceed()
|
||||
{
|
||||
WithStore((fs, _) =>
|
||||
{
|
||||
const int consumerCount = 400;
|
||||
var start = new ManualResetEventSlim(false);
|
||||
var errors = new ConcurrentQueue<Exception>();
|
||||
var timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds() * 1_000_000_000L;
|
||||
|
||||
var workers = new List<Task>(consumerCount);
|
||||
for (var i = 0; i < consumerCount; i++)
|
||||
{
|
||||
var consumer = fs.ConsumerStore(
|
||||
$"o{i}",
|
||||
DateTime.UtcNow,
|
||||
new ConsumerConfig { AckPolicy = AckPolicy.AckExplicit });
|
||||
|
||||
workers.Add(Task.Run(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
start.Wait(TimeSpan.FromSeconds(5));
|
||||
consumer.UpdateDelivered(22, 22, 1, timestamp);
|
||||
consumer.EncodedState();
|
||||
consumer.Delete();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errors.Enqueue(ex);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
start.Set();
|
||||
Task.WaitAll(workers.ToArray());
|
||||
errors.ShouldBeEmpty();
|
||||
});
|
||||
}
|
||||
|
||||
[Fact] // T:2452
|
||||
public void NoRaceFileStoreStreamMaxAgePerformance_ShouldSucceed()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user