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
This commit is contained in:
92
tests/NATS.Server.Tests/Mqtt/MqttModelParityBatch3Tests.cs
Normal file
92
tests/NATS.Server.Tests/Mqtt/MqttModelParityBatch3Tests.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using NATS.Server.Mqtt;
|
||||
|
||||
namespace NATS.Server.Tests.Mqtt;
|
||||
|
||||
public class MqttModelParityBatch3Tests
|
||||
{
|
||||
[Fact]
|
||||
public void Mqtt_helper_models_cover_go_core_shapes()
|
||||
{
|
||||
var jsa = new MqttJsa
|
||||
{
|
||||
AccountName = "A",
|
||||
ReplyPrefix = "$MQTT.JSA.A",
|
||||
Domain = "D1",
|
||||
};
|
||||
|
||||
var pubMsg = new MqttJsPubMsg
|
||||
{
|
||||
Subject = "$MQTT.msgs.s1",
|
||||
Payload = new byte[] { 1, 2, 3 },
|
||||
ReplyTo = "$MQTT.JSA.A.reply",
|
||||
};
|
||||
|
||||
var delete = new MqttRetMsgDel
|
||||
{
|
||||
Topic = "devices/x",
|
||||
Sequence = 123,
|
||||
};
|
||||
|
||||
var persisted = new MqttPersistedSession
|
||||
{
|
||||
ClientId = "c1",
|
||||
LastPacketId = 7,
|
||||
MaxAckPending = 1024,
|
||||
};
|
||||
|
||||
var retainedRef = new MqttRetainedMessageRef
|
||||
{
|
||||
StreamSequence = 88,
|
||||
Subject = "$MQTT.rmsgs.devices/x",
|
||||
};
|
||||
|
||||
var sub = new MqttSub
|
||||
{
|
||||
Filter = "devices/+",
|
||||
Qos = 1,
|
||||
JsDur = "DUR-c1",
|
||||
Prm = true,
|
||||
Reserved = false,
|
||||
};
|
||||
|
||||
var filter = new MqttFilter
|
||||
{
|
||||
Filter = "devices/#",
|
||||
Qos = 1,
|
||||
TopicToken = "devices",
|
||||
};
|
||||
|
||||
var parsedHeader = new MqttParsedPublishNatsHeader
|
||||
{
|
||||
Subject = "devices/x",
|
||||
Mapped = "devices.y",
|
||||
IsPublish = true,
|
||||
IsPubRel = false,
|
||||
};
|
||||
|
||||
jsa.AccountName.ShouldBe("A");
|
||||
pubMsg.Payload.ShouldBe(new byte[] { 1, 2, 3 });
|
||||
delete.Sequence.ShouldBe(123UL);
|
||||
persisted.MaxAckPending.ShouldBe(1024);
|
||||
retainedRef.StreamSequence.ShouldBe(88UL);
|
||||
sub.JsDur.ShouldBe("DUR-c1");
|
||||
filter.TopicToken.ShouldBe("devices");
|
||||
parsedHeader.IsPublish.ShouldBeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Retained_message_model_includes_origin_flags_and_source_fields()
|
||||
{
|
||||
var msg = new MqttRetainedMessage(
|
||||
Topic: "devices/x",
|
||||
Payload: new byte[] { 0x41, 0x42 },
|
||||
Origin: "origin-a",
|
||||
Flags: 0b_0000_0011,
|
||||
Source: "src-a");
|
||||
|
||||
msg.Topic.ShouldBe("devices/x");
|
||||
msg.Origin.ShouldBe("origin-a");
|
||||
msg.Flags.ShouldBe((byte)0b_0000_0011);
|
||||
msg.Source.ShouldBe("src-a");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user