Path: redb-route/tests/redb.Route.Tests/Cluster/StartupWarningTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests/Cluster/StartupWarningTests.cs ---- using AwesomeAssertions; using Microsoft.Extensions.Logging; using redb.Route.Configuration; using redb.Route.Core; namespace redb.Route.Tests.Cluster; /// /// Verifies the startup-check warning emitted when a route declares .Cluster(true) /// but no is registered. /// public class StartupWarningTests : IAsyncLifetime { private readonly CapturingLoggerProvider _capture = new(); private readonly RouteContext _context; public StartupWarningTests() { var lf = LoggerFactory.Create(b => b.AddProvider(_capture).SetMinimumLevel(LogLevel.Debug)); _context = new RouteContext(loggerFactory: lf, options: new RouteEngineOptions { StartupChecks = true }); } public Task InitializeAsync() => Task.CompletedTask; public async Task DisposeAsync() { await _context.DisposeAsync(); GC.SuppressFinalize(this); } [Fact] public async Task Cluster_route_without_factory_emits_warning_once() { _context.AddRoutes(r => r.From("direct://x").RouteId("x").Cluster(true).Process(_ => { })); await _context.Start(); _capture.Entries .Count(e => e.Level == LogLevel.Warning && e.Message.Contains("no IRoutePolicyFactory")) .Should().Be(1); } [Fact] public async Task Standalone_route_emits_no_warning() { _context.AddRoutes(r => r.From("direct://y").RouteId("y").Process(_ => { })); await _context.Start(); _capture.Entries.Should().NotContain(e => e.Level == LogLevel.Warning && e.Message.Contains("IRoutePolicyFactory")); } [Fact] public async Task StartupChecks_disabled_silences_the_warning() { await _context.DisposeAsync(); var lf = LoggerFactory.Create(b => b.AddProvider(_capture).SetMinimumLevel(LogLevel.Debug)); await using var ctx = new RouteContext( loggerFactory: lf, options: new RouteEngineOptions { StartupChecks = false }); ctx.AddRoutes(r => r.From("direct://z").RouteId("z").Cluster(true).Process(_ => { })); await ctx.Start(); _capture.Entries.Should().NotContain(e => e.Level == LogLevel.Warning && e.Message.Contains("IRoutePolicyFactory")); } }