mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-29 15:11:53 +08:00
Fix flaky data channel budget assertions
Check per-flow DATA reservations instead of the shared message total, which also counts concurrently admitted control frames. Dispose shared Core contexts before asserting that close-control reservations have drained after PubSub stops.
This commit is contained in:
@@ -181,7 +181,8 @@ namespace Opc.Ua.Core.DataChannels.Tests.Runtime
|
||||
{
|
||||
Assert.That(pending.IsCompleted, Is.False);
|
||||
Assert.That(waiting.Local.StateData.LastDataId, Is.Zero);
|
||||
Assert.That(budget.Usage.Messages, Is.EqualTo(heldCount));
|
||||
Assert.That(occupied.Local.StateData.SendMessages, Is.EqualTo(heldCount));
|
||||
Assert.That(waiting.Local.StateData.SendMessages, Is.Zero);
|
||||
first.InitiatorCarrier.BeforeRelease.TrySetResult(true);
|
||||
Assert.That(await Task.WhenAll(held).WaitAsync(TimeSpan.FromSeconds(5)).ConfigureAwait(false),
|
||||
Is.All.EqualTo(DataChannelResult.Good));
|
||||
|
||||
@@ -431,6 +431,12 @@ namespace Opc.Ua.PubSub.Tests.Transports.DataChannels
|
||||
{
|
||||
Assert.That(core.LeftBudget.Usage.Flows, Is.Zero);
|
||||
Assert.That(core.RightBudget.Usage.Flows, Is.Zero);
|
||||
});
|
||||
// Shared Core contexts can still own close-control reservations after the PubSub flows stop.
|
||||
await core.Left.DisposeAsync().ConfigureAwait(false);
|
||||
await core.Right.DisposeAsync().ConfigureAwait(false);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(core.LeftBudget.Usage.Messages, Is.Zero);
|
||||
Assert.That(core.RightBudget.Usage.Messages, Is.Zero);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user