feat: add jetstream publish preconditions and dedupe

This commit is contained in:
Joseph Doherty
2026-02-23 06:05:01 -05:00
parent d73e7e2f88
commit 6825839191
4 changed files with 61 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
namespace NATS.Server.Tests;
public class JetStreamPublishPreconditionTests
{
[Fact]
public async Task Duplicate_msg_id_is_rejected_with_expected_error()
{
await using var fixture = await JetStreamApiFixture.StartWithStreamAsync("D", "d.*");
await fixture.PublishAndGetAckAsync("d.a", "x", msgId: "id-1");
var second = await fixture.PublishAndGetAckAsync("d.a", "x", msgId: "id-1", expectError: true);
second.ErrorCode.ShouldBe(10071);
}
}