feat(batch24): complete leaf nodes implementation and verification
This commit is contained in:
@@ -204,4 +204,31 @@ public sealed partial class RouteHandlerTests
|
||||
public Task<string[]> LookupHostAsync(string host, CancellationToken ct = default)
|
||||
=> Task.FromResult(hosts);
|
||||
}
|
||||
|
||||
[Fact] // T:2825
|
||||
public void ClusterQueueGroupWeightTrackingLeak_ShouldSucceed()
|
||||
{
|
||||
var account = Account.NewAccount("$G");
|
||||
var queueSub = new Subscription
|
||||
{
|
||||
Subject = "foo"u8.ToArray(),
|
||||
Queue = "bar"u8.ToArray(),
|
||||
Qw = 1,
|
||||
};
|
||||
|
||||
account.UpdateLeafNodes(queueSub, 1);
|
||||
|
||||
var lqwsField = typeof(Account).GetField("_lqws", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
|
||||
lqwsField.ShouldNotBeNull();
|
||||
|
||||
var lqws = (Dictionary<string, int>?)lqwsField!.GetValue(account);
|
||||
lqws.ShouldNotBeNull();
|
||||
lqws!.TryGetValue("foo bar", out var initialWeight).ShouldBeTrue();
|
||||
initialWeight.ShouldBe(1);
|
||||
|
||||
account.UpdateLeafNodes(queueSub, -1);
|
||||
|
||||
lqws = (Dictionary<string, int>?)lqwsField.GetValue(account);
|
||||
(lqws?.ContainsKey("foo bar") ?? false).ShouldBeFalse();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user