diff --git a/tests/NATS.Client.Core.Tests/ClusterTests.cs b/tests/NATS.Client.Core.Tests/ClusterTests.cs index 9f647a572..05b3f2cec 100644 --- a/tests/NATS.Client.Core.Tests/ClusterTests.cs +++ b/tests/NATS.Client.Core.Tests/ClusterTests.cs @@ -15,9 +15,11 @@ public async Task Seed_urls_on_retry(bool userAuthInUrl) b.WithServerName($"c1n{i}"); if (userAuthInUrl) { - b.WithClientUrlAuthentication("user", "pass"); + b.AddServerConfig("resources/configs/auth/password.conf"); + b.WithClientUrlAuthentication("a", "b"); } - }); + }, + userAuthInUrl); await using var cluster2 = new NatsCluster( new NullOutputHelper(), @@ -27,9 +29,11 @@ public async Task Seed_urls_on_retry(bool userAuthInUrl) b.WithServerName($"c2n{i}"); if (userAuthInUrl) { - b.WithClientUrlAuthentication("user", "pass"); + b.AddServerConfig("resources/configs/auth/password.conf"); + b.WithClientUrlAuthentication("a", "b"); } - }); + }, + userAuthInUrl); // Use the first node from each cluster as the seed // so that we can confirm seeds are used on retry diff --git a/tests/NATS.Client.TestUtilities/NatsServer.cs b/tests/NATS.Client.TestUtilities/NatsServer.cs index dba7e9eab..682a3fa79 100644 --- a/tests/NATS.Client.TestUtilities/NatsServer.cs +++ b/tests/NATS.Client.TestUtilities/NatsServer.cs @@ -494,7 +494,7 @@ public class NatsCluster : IAsyncDisposable { private readonly ITestOutputHelper _outputHelper; - public NatsCluster(ITestOutputHelper outputHelper, TransportType transportType, Action? configure = default) + public NatsCluster(ITestOutputHelper outputHelper, TransportType transportType, Action? configure = default, bool useAuthInUrl = false) { _outputHelper = outputHelper; @@ -546,13 +546,13 @@ public NatsCluster(ITestOutputHelper outputHelper, TransportType transportType, } _outputHelper.WriteLine($"Starting server 1..."); - Server1 = NatsServer.Start(outputHelper, opts1); + Server1 = NatsServer.Start(outputHelper, opts1, useAuthInUrl: useAuthInUrl); _outputHelper.WriteLine($"Starting server 2..."); - Server2 = NatsServer.Start(outputHelper, opts2); + Server2 = NatsServer.Start(outputHelper, opts2, useAuthInUrl: useAuthInUrl); _outputHelper.WriteLine($"Starting server 3..."); - Server3 = NatsServer.Start(outputHelper, opts3); + Server3 = NatsServer.Start(outputHelper, opts3, useAuthInUrl: useAuthInUrl); } public NatsServer Server1 { get; }