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:
82
tests/NATS.E2E.Tests/Infrastructure/AuthServerFixture.cs
Normal file
82
tests/NATS.E2E.Tests/Infrastructure/AuthServerFixture.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using NATS.Client.Core;
|
||||
using NATS.NKeys;
|
||||
|
||||
namespace NATS.E2E.Tests.Infrastructure;
|
||||
|
||||
public sealed class AuthServerFixture : IAsyncLifetime
|
||||
{
|
||||
private NatsServerProcess _server = null!;
|
||||
|
||||
public string NKeyPublicKey { get; }
|
||||
public string NKeySeed { get; }
|
||||
|
||||
public int Port => _server.Port;
|
||||
|
||||
public AuthServerFixture()
|
||||
{
|
||||
var kp = KeyPair.CreatePair(PrefixByte.User);
|
||||
NKeyPublicKey = kp.GetPublicKey();
|
||||
NKeySeed = kp.GetSeed();
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
var config = $$"""
|
||||
max_payload: 512
|
||||
|
||||
authorization {
|
||||
users: [
|
||||
{ user: "testuser", password: "testpass" },
|
||||
{
|
||||
user: "pubonly",
|
||||
password: "pubpass",
|
||||
permissions: {
|
||||
publish: { allow: ["allowed.>"] },
|
||||
subscribe: { allow: ["_INBOX.>"] }
|
||||
}
|
||||
},
|
||||
{
|
||||
user: "subonly",
|
||||
password: "subpass",
|
||||
permissions: {
|
||||
subscribe: { allow: ["allowed.>", "_INBOX.>"] },
|
||||
publish: { allow: ["_INBOX.>"] }
|
||||
}
|
||||
},
|
||||
{ user: "limited", password: "limpass" },
|
||||
{ nkey: "{{NKeyPublicKey}}" }
|
||||
]
|
||||
}
|
||||
|
||||
max_subs: 5
|
||||
""";
|
||||
|
||||
_server = NatsServerProcess.WithConfig(config);
|
||||
await _server.StartAsync();
|
||||
}
|
||||
|
||||
public async Task DisposeAsync()
|
||||
{
|
||||
await _server.DisposeAsync();
|
||||
}
|
||||
|
||||
public NatsConnection CreateClient(string user, string password)
|
||||
{
|
||||
var opts = new NatsOpts
|
||||
{
|
||||
Url = $"nats://127.0.0.1:{Port}",
|
||||
AuthOpts = new NatsAuthOpts
|
||||
{
|
||||
Username = user,
|
||||
Password = password,
|
||||
},
|
||||
};
|
||||
return new NatsConnection(opts);
|
||||
}
|
||||
|
||||
public NatsConnection CreateClient()
|
||||
=> new(new NatsOpts { Url = $"nats://127.0.0.1:{Port}" });
|
||||
}
|
||||
|
||||
[CollectionDefinition("E2E-Auth")]
|
||||
public class AuthCollection : ICollectionFixture<AuthServerFixture>;
|
||||
Reference in New Issue
Block a user