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:
Joseph Doherty
2026-03-12 14:09:23 -04:00
parent 79c1ee8776
commit c30e67a69d
226 changed files with 17801 additions and 709 deletions

View File

@@ -1,6 +1,10 @@
// Port of Go conf/lex.go — state-machine tokenizer for NATS config files.
// Reference: golang/nats-server/conf/lex.go
using System.Buffers;
using System.Globalization;
using System.Text;
namespace NATS.Server.Configuration;
public sealed class NatsConfLexer
@@ -145,16 +149,23 @@ public sealed class NatsConfLexer
return Eof;
}
if (_input[_pos] == '\n')
var span = _input.AsSpan(_pos);
var status = Rune.DecodeFromUtf16(span, out var rune, out var consumed);
if (status != OperationStatus.Done || consumed <= 0)
{
consumed = 1;
rune = new Rune(_input[_pos]);
}
if (rune.Value == '\n')
{
_line++;
_lstart = _pos;
}
var c = _input[_pos];
_width = 1;
_pos += _width;
return c;
_width = consumed;
_pos += consumed;
return rune.IsBmp ? (char)rune.Value : '\uFFFD';
}
private void Ignore()
@@ -186,6 +197,20 @@ public sealed class NatsConfLexer
return null;
}
private LexState? Errorf(string format, params object?[] args)
{
if (args.Length == 0)
return Errorf(format);
var escapedArgs = new object?[args.Length];
for (var i = 0; i < args.Length; i++)
{
escapedArgs[i] = args[i] is char c ? EscapeSpecial(c) : args[i];
}
return Errorf(string.Format(CultureInfo.InvariantCulture, format, escapedArgs));
}
// --- Helper methods ---
private static bool IsWhitespace(char c) => c is '\t' or ' ';
@@ -1476,9 +1501,8 @@ public sealed class NatsConfLexer
var r = lx.Peek();
if (IsNL(r) || r == Eof)
{
// Consume the comment text but don't emit it as a user-visible token.
// Just ignore it and pop back.
lx.Ignore();
// Match Go behavior: emit comment body as a text token.
lx.Emit(TokenType.Text);
return lx.Pop();
}