Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmk committed Sep 25, 2024
1 parent 4215e5e commit 8eb200d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions tests/NATS.Client.Core.Tests/TlsClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ public async Task Client_connect_using_certificate(TransportType transportType)

var clientOpts = server.ClientOpts(NatsOpts.Default with { Name = "tls-test-client" });
await using var nats = new NatsConnection(clientOpts);
await nats.ConnectAsync();
var rtt = await nats.PingAsync();
Assert.True(rtt > TimeSpan.Zero);

await Task.Run(async () =>
{
await nats.ConnectAsync();
await nats.PingAsync();
}).WaitAsync(TimeSpan.FromSeconds(10));
}

[Fact]
Expand All @@ -52,10 +55,13 @@ public async Task Client_connect_using_certificate_and_revocation_check()
};
await using var nats = new NatsConnection(clientOpts);

// At the moment I don't know of a good way of checking if the revocation check is working
// except to check if the connection fails. So we are expecting an exception here.
var exception = await Assert.ThrowsAnyAsync<Exception>(async () => await nats.ConnectAsync());
Assert.Contains("remote certificate was rejected", exception.InnerException!.InnerException!.Message);
await Task.Run(async () =>
{
// At the moment I don't know of a good way of checking if the revocation check is working
// except to check if the connection fails. So we are expecting an exception here.
var exception = await Assert.ThrowsAnyAsync<Exception>(async () => await nats.ConnectAsync());
Assert.Contains("remote certificate was rejected", exception.InnerException!.InnerException!.Message);
}).WaitAsync(TimeSpan.FromSeconds(10));
}

[Theory]
Expand Down

0 comments on commit 8eb200d

Please sign in to comment.