Skip to content

Commit

Permalink
Update ToxiProxy and Pulsar images and adjust timeout intervals
Browse files Browse the repository at this point in the history
The commit updates the used images of ToxiProxy and Pulsar in tests from versions 2.7.0 and 3.1.3 to 2.9.0 and 3.2.3 respectively to keep up with the latest versions. Also, it introduces longer timeout intervals in the PulsarClientTests, changing them from 10 seconds to 2 hours for more reliable results. Finally, it improves task cancellation functionality in ConnectionPool for more robust error handling.
  • Loading branch information
David Jensen committed May 27, 2024
1 parent 7577aa6 commit 15eb3fe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/DotPulsar/Internal/ConnectionPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private async Task<Connection> EstablishNewConnection(PulsarUrl url, Cancellatio
commandConnect = WithProxyToBroker(commandConnect, url.Logical);

var connection = Connection.Connect(new PulsarStream(stream), _authentication, _keepAliveInterval, _closeInactiveConnectionsInterval);
_ = connection.OnStateChangeFrom(ConnectionState.Connected, CancellationToken.None).AsTask().ContinueWith(t => DisposeConnection(url, connection));
_ = connection.OnStateChangeFrom(ConnectionState.Connected, CancellationToken.None).AsTask().ContinueWith(t => DisposeConnection(url, connection), cancellationToken);
var response = await connection.Send(commandConnect, cancellationToken).ConfigureAwait(false);
response.Expect(BaseCommand.Type.Connected);
_connections[url] = connection;
Expand Down
4 changes: 2 additions & 2 deletions tests/DotPulsar.Tests/IntegrationFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public IntegrationFixture(IMessageSink messageSink)
.Build();

_toxiProxy = new ContainerBuilder()
.WithImage("ghcr.io/shopify/toxiproxy:2.7.0")
.WithImage("ghcr.io/shopify/toxiproxy:2.9.0")
.WithPortBinding(ToxiProxyControlPort, true)
.WithPortBinding(ToxiProxyPort, true)
.WithHostname("toxiproxy")
Expand All @@ -78,7 +78,7 @@ public IntegrationFixture(IMessageSink messageSink)
.Build();

_pulsarCluster = new ContainerBuilder()
.WithImage("apachepulsar/pulsar:3.1.3")
.WithImage("apachepulsar/pulsar:3.2.3")
.WithEnvironment(environmentVariables)
.WithHostname("pulsar")
.WithNetwork(_network)
Expand Down
4 changes: 2 additions & 2 deletions tests/DotPulsar.Tests/PulsarClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task TokenSupplier_WhenTokenSupplierThrowsAnExceptionOnAuthChalleng
{
if (throwException)
throw new Exception();
var token = await _fixture.CreateToken(TimeSpan.FromSeconds(10), _cts.Token);
var token = await _fixture.CreateToken(TimeSpan.FromHours(2), _cts.Token);
_testOutputHelper.Log($"Received token: '{token}'");
return token;
});
Expand Down Expand Up @@ -109,7 +109,7 @@ public async Task TokenSupplier_WhenTokenSupplierReturnValidToken_ShouldStayConn
if (refreshCount == 3)
tcs.SetResult();

var token = await _fixture.CreateToken(TimeSpan.FromSeconds(10), _cts.Token);
var token = await _fixture.CreateToken(TimeSpan.FromHours(2), _cts.Token);
_testOutputHelper.Log($"Received token: '{token}'");
return token;
});
Expand Down

0 comments on commit 15eb3fe

Please sign in to comment.