Files
natsdotnet/tests/NATS.Server.Tests/Subscriptions/SubjectSubsetMatchParityBatch1Tests.cs
Joseph Doherty c30e67a69d Fix E2E test gaps and add comprehensive E2E + parity test suites
- Fix pull consumer fetch: send original stream subject in HMSG (not inbox)
  so NATS client distinguishes data messages from control messages
- Fix MaxAge expiry: add background timer in StreamManager for periodic pruning
- Fix JetStream wire format: Go-compatible anonymous objects with string enums,
  proper offset-based pagination for stream/consumer list APIs
- Add 42 E2E black-box tests (core messaging, auth, TLS, accounts, JetStream)
- Add ~1000 parity tests across all subsystems (gaps closure)
- Update gap inventory docs to reflect implementation status
2026-03-12 14:09:23 -04:00

41 lines
1.4 KiB
C#

using NATS.Server.Subscriptions;
namespace NATS.Server.Tests.Subscriptions;
public class SubjectSubsetMatchParityBatch1Tests
{
[Theory]
[InlineData("foo.bar", "foo.bar", true)]
[InlineData("foo.bar", "foo.*", true)]
[InlineData("foo.bar", "foo.>", true)]
[InlineData("foo.bar", "*.*", true)]
[InlineData("foo.bar", ">", true)]
[InlineData("foo.bar", "foo.baz", false)]
[InlineData("foo.bar.baz", "foo.*", false)]
public void SubjectMatchesFilter_matches_go_subset_behavior(string subject, string filter, bool expected)
{
SubjectMatch.SubjectMatchesFilter(subject, filter).ShouldBe(expected);
}
[Fact]
public void SubjectIsSubsetMatch_uses_subject_tokens_against_test_pattern()
{
SubjectMatch.SubjectIsSubsetMatch("foo.*", "foo.*").ShouldBeTrue();
SubjectMatch.SubjectIsSubsetMatch("foo.*", "foo.bar").ShouldBeFalse();
}
[Fact]
public void IsSubsetMatch_tokenizes_test_subject_and_delegates_to_tokenized_matcher()
{
SubjectMatch.IsSubsetMatch(["foo", "bar"], "foo.*").ShouldBeTrue();
SubjectMatch.IsSubsetMatch(["foo", "bar"], "foo.baz").ShouldBeFalse();
}
[Fact]
public void IsSubsetMatchTokenized_handles_fwc_and_rejects_empty_tokens_like_go()
{
SubjectMatch.IsSubsetMatchTokenized(["foo", "bar"], ["foo", ">"]).ShouldBeTrue();
SubjectMatch.IsSubsetMatchTokenized(["foo", "bar"], ["foo", ""]).ShouldBeFalse();
}
}