Skip to content

Commit

Permalink
fix cluster test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrxx99 committed Nov 2, 2024
1 parent b28adc6 commit 17d7d1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 8 additions & 4 deletions tests/NATS.Client.Core.Tests/ClusterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/NATS.Client.TestUtilities/NatsServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public class NatsCluster : IAsyncDisposable
{
private readonly ITestOutputHelper _outputHelper;

public NatsCluster(ITestOutputHelper outputHelper, TransportType transportType, Action<int, NatsServerOptsBuilder>? configure = default)
public NatsCluster(ITestOutputHelper outputHelper, TransportType transportType, Action<int, NatsServerOptsBuilder>? configure = default, bool useAuthInUrl = false)
{
_outputHelper = outputHelper;

Expand Down Expand Up @@ -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; }
Expand Down

0 comments on commit 17d7d1f

Please sign in to comment.