Port session P7-09: add tests from jetstream_versioning_test.go (T:1791–1808),
dirstore_test.go (T:285–296), jetstream_batching_test.go (T:716–744),
jetstream_errors_test.go (T:1381–1384), and accounts_test.go (T:80–110).
- JetStreamVersioningTests: 12 active unit tests + 6 deferred (server-required)
- DirectoryStoreTests: 12 filesystem tests using fake JWTs (no NKeys dependency)
- JetStreamBatchingTests: 29 deferred stubs (all require running JetStream cluster)
- JetStreamErrorsTests: 4 deferred stubs (NewJS* factories not yet ported)
- accounts_test.go T:80–110: 31 deferred (all use RunServerWithConfig)
Fix DirJwtStore.cs expiration bugs:
- Use DateTimeOffset.UtcNow.UtcTicks (not Unix-relative ticks) for expiry comparison
- Replace in-place JwtItem mutation with new-object replacement so DrainStale
can detect stale heap entries via ReferenceEquals check
Add JetStreamVersioning.cs methods: SetStaticStreamMetadata,
SetDynamicStreamMetadata, CopyStreamMetadata, SetStaticConsumerMetadata,
SetDynamicConsumerMetadata, SetDynamicConsumerInfoMetadata, CopyConsumerMetadata.
Tests: 725 pass, 53 skipped/deferred, 0 failures.
DB: +24 complete, +66 deferred.
51 lines
2.6 KiB
C#
51 lines
2.6 KiB
C#
// Copyright 2020-2025 The NATS Authors
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
//
|
|
// Mirrors server/jetstream_errors_test.go in the NATS server Go source.
|
|
//
|
|
// All 4 tests are deferred:
|
|
// T:1381 — TestIsNatsErr: uses IsNatsErr(error, ...) where the Go version accepts
|
|
// arbitrary error interface values (including plain errors.New("x") which
|
|
// evaluates to false). The .NET JsApiErrors.IsNatsError only accepts JsApiError?
|
|
// and the "NewJS*" factory constructors (NewJSRestoreSubscribeFailedError etc.)
|
|
// that populate Description templates from tags have not been ported yet.
|
|
// T:1382 — TestApiError_Error: uses ApiErrors[JSClusterNotActiveErr].Error() — the Go
|
|
// ApiErrors map and per-error .Error() method (returns "description (errCode)")
|
|
// differs from the .NET JsApiErrors.ClusterNotActive.ToString() convention.
|
|
// T:1383 — TestApiError_NewWithTags: uses NewJSRestoreSubscribeFailedError with tag
|
|
// substitution — factory constructors not yet ported.
|
|
// T:1384 — TestApiError_NewWithUnless: uses NewJSStreamRestoreError, Unless() helper,
|
|
// NewJSPeerRemapError — not yet ported.
|
|
|
|
namespace ZB.MOM.NatsNet.Server.Tests.JetStream;
|
|
|
|
/// <summary>
|
|
/// Tests for JetStream API error types and IsNatsErr helper.
|
|
/// Mirrors server/jetstream_errors_test.go.
|
|
/// All tests deferred pending port of Go factory constructors and tag-substitution system.
|
|
/// </summary>
|
|
public sealed class JetStreamErrorsTests
|
|
{
|
|
[Fact(Skip = "deferred: NewJS* factory constructors and IsNatsErr(error) not yet ported")] // T:1381
|
|
public void IsNatsErr_ShouldSucceed() { }
|
|
|
|
[Fact(Skip = "deferred: ApiErrors map and .Error() method not yet ported")] // T:1382
|
|
public void ApiError_Error_ShouldSucceed() { }
|
|
|
|
[Fact(Skip = "deferred: NewJSRestoreSubscribeFailedError with tag substitution not yet ported")] // T:1383
|
|
public void ApiError_NewWithTags_ShouldSucceed() { }
|
|
|
|
[Fact(Skip = "deferred: NewJSStreamRestoreError / Unless() helper not yet ported")] // T:1384
|
|
public void ApiError_NewWithUnless_ShouldSucceed() { }
|
|
}
|