Path: redb-route/tests/redb.Route.Tests.Elasticsearch/ElasticsearchClientLogTests.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.Elasticsearch/ElasticsearchClientLogTests.cs ---- using Microsoft.Extensions.Logging; using redb.Route.Core; using redb.Route.Elasticsearch; using redb.Route.Tests.Cluster; namespace redb.Route.Tests.Elasticsearch; /// /// The "client created" log names the nodes the client was built with: a connection factory's, not the endpoint's /// default Nodes (http://localhost:9200), which a user then took for the address in use. /// public sealed class ElasticsearchClientLogTests { [Fact] public async Task ClientCreated_WithAConnectionFactory_LogsTheFactorysNodes() { var capture = new CapturingLoggerProvider(); using var loggerFactory = LoggerFactory.Create(b => b.AddProvider(capture).SetMinimumLevel(LogLevel.Debug)); await using var context = new RouteContext(loggerFactory: loggerFactory); context.AddComponent(new ElasticsearchComponent()); context.AddToRegistry("cluster", new ElasticsearchConnectionFactory { Nodes = "http://es-a.internal:9201,http://es-b.internal:9201" }); var endpoint = (ElasticsearchEndpoint)context.GetEndpoint("elasticsearch://orders?connectionFactory=cluster"); await endpoint.GetOrCreateClientAsync(); var created = capture.Entries.Single(e => e.Message.StartsWith("Elasticsearch client created", StringComparison.Ordinal)).Message; created.Should().Contain("http://es-a.internal:9201").And.Contain("http://es-b.internal:9201").And.Contain("cluster"); created.Should().NotContain("localhost:9200", "that is the endpoint's default, not what the client connects to"); } [Fact] public async Task ClientCreated_FromTheUri_LogsTheUrisNodes_WithoutCredentials() { var capture = new CapturingLoggerProvider(); using var loggerFactory = LoggerFactory.Create(b => b.AddProvider(capture).SetMinimumLevel(LogLevel.Debug)); await using var context = new RouteContext(loggerFactory: loggerFactory); context.AddComponent(new ElasticsearchComponent()); var endpoint = (ElasticsearchEndpoint)context.GetEndpoint("elasticsearch://orders?nodes=http://user:secret@es-c.internal:9202"); await endpoint.GetOrCreateClientAsync(); var created = capture.Entries.Single(e => e.Message.StartsWith("Elasticsearch client created", StringComparison.Ordinal)).Message; created.Should().Contain("es-c.internal:9202").And.NotContain("secret"); } }