test: lock SubList remote-key and match behavior

This commit is contained in:
Joseph Doherty
2026-03-13 09:49:54 -04:00
parent 0be321fa53
commit 08bd34c529
3 changed files with 92 additions and 0 deletions

View File

@@ -47,6 +47,23 @@ public class RouteRemoteSubCleanupParityBatch2Tests
sl.HasRemoteInterest("B", "orders.created").ShouldBeTrue();
}
[Fact]
public void Applying_same_remote_subscription_twice_is_idempotent_for_interest_tracking()
{
using var sl = new SubList();
var changes = new List<InterestChange>();
sl.InterestChanged += changes.Add;
var sub = new RemoteSubscription("orders.*", "workers", "r1", "A");
sl.ApplyRemoteSub(sub);
sl.ApplyRemoteSub(sub);
sl.HasRemoteInterest("A", "orders.created").ShouldBeTrue();
sl.MatchRemote("A", "orders.created").Count.ShouldBe(1);
changes.Count(change => change.Kind == InterestChangeKind.RemoteAdded).ShouldBe(1);
}
[Fact]
public async Task Route_disconnect_cleans_remote_interest_without_explicit_rs_minus()
{