Skip to content

Commit

Permalink
chore: Update Pulsar version and improve affected version check
Browse files Browse the repository at this point in the history
The default Pulsar image version changed from "3.2.3" to "3.0.6" due to a known regression impacting versions "3.2.0-3.2.3" and "3.3.0". The regression resulted in the expiry time being converted to an incorrect unit of time.
The revision improves the check for affected versions by introducing the 'IsVersionAffectedByRegression' method, which accepts a version and returns true if the version is impacted by the regression.
The formatting of the PulsarContainer.cs and PulsarBuilder.cs files was also updated for better readability.
In addition, the `docs/modules/index.md` file was updated to reflect the new Pulsar version, making it easier for users to use the correct version.
  • Loading branch information
David Jensen authored and entvex committed Sep 3, 2024
1 parent 5b3d494 commit 39f6e42
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 69 deletions.
130 changes: 65 additions & 65 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.3.1"/>
<PackageVersion Include="Docker.DotNet.X509" Version="3.125.15"/>
<PackageVersion Include="Docker.DotNet" Version="3.125.15"/>
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0"/>
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1"/>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4"/>
<PackageVersion Include="ReflectionMagic" Version="5.0.1"/>
<PackageVersion Include="SharpZipLib" Version="1.4.2"/>
<PackageVersion Include="SSH.NET" Version="2023.0.0"/>
<PackageVersion Include="System.Text.Json" Version="6.0.9"/>
<!-- Unit and integration test dependencies: -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="8.2.0"/>
<PackageVersion Include="coverlet.collector" Version="6.0.1"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7"/>
<PackageVersion Include="xunit" Version="2.7.0"/>
<!-- Third-party client dependencies to connect and interact with the containers: -->
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.0"/>
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1"/>
<PackageVersion Include="AWSSDK.CloudWatchLogs" Version="3.7.104.14"/>
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.101.42"/>
<PackageVersion Include="AWSSDK.S3" Version="3.7.103.3"/>
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="3.7.101.7"/>
<PackageVersion Include="AWSSDK.SQS" Version="3.7.100.71"/>
<PackageVersion Include="Azure.Data.Tables" Version="12.8.0"/>
<PackageVersion Include="Azure.Storage.Blobs" Version="12.17.0"/>
<PackageVersion Include="Azure.Storage.Queues" Version="12.15.0"/>
<PackageVersion Include="ClickHouse.Client" Version="6.7.1"/>
<PackageVersion Include="Confluent.Kafka" Version="2.0.2"/>
<PackageVersion Include="Consul" Version="1.6.10.9"/>
<PackageVersion Include="CouchbaseNetClient" Version="3.4.3"/>
<PackageVersion Include="DotPulsar" Version="3.1.2"/>
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="8.0.5"/>
<PackageVersion Include="EventStore.Client.Grpc.Streams" Version="22.0.0"/>
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="10.0.0"/>
<PackageVersion Include="Google.Cloud.BigQuery.V2" Version="3.4.0"/>
<PackageVersion Include="Google.Cloud.Bigtable.Admin.V2" Version="3.7.0"/>
<PackageVersion Include="Google.Cloud.Firestore" Version="3.1.0"/>
<PackageVersion Include="Google.Cloud.PubSub.V1" Version="3.5.0"/>
<PackageVersion Include="Google.Cloud.Storage.V1" Version="4.6.0"/>
<PackageVersion Include="InfluxDB.Client" Version="4.12.0"/>
<PackageVersion Include="JanusGraph.Net" Version="1.0.0"/>
<PackageVersion Include="Keycloak.Net.Core" Version="1.0.20"/>
<PackageVersion Include="KubernetesClient" Version="10.1.4"/>
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.32.1"/>
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="11.3.3"/>
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.3"/>
<PackageVersion Include="Milvus.Client" Version="2.2.2-preview.6"/>
<PackageVersion Include="MongoDB.Driver" Version="2.19.0"/>
<PackageVersion Include="MyCouch" Version="7.6.0"/>
<PackageVersion Include="MySqlConnector" Version="2.2.5"/>
<PackageVersion Include="NATS.Client" Version="1.0.8"/>
<PackageVersion Include="Neo4j.Driver" Version="5.5.0"/>
<PackageVersion Include="Npgsql" Version="6.0.11"/>
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.90"/>
<PackageVersion Include="RabbitMQ.Client" Version="6.4.0"/>
<PackageVersion Include="RavenDB.Client" Version="5.4.100"/>
<PackageVersion Include="Selenium.WebDriver" Version="4.8.1"/>
<PackageVersion Include="StackExchange.Redis" Version="2.6.90"/>
</ItemGroup>
</Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.3.1" />
<PackageVersion Include="Docker.DotNet.X509" Version="3.125.15" />
<PackageVersion Include="Docker.DotNet" Version="3.125.15" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.4" />
<PackageVersion Include="ReflectionMagic" Version="5.0.1" />
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
<PackageVersion Include="SSH.NET" Version="2023.0.0" />
<PackageVersion Include="System.Text.Json" Version="6.0.9" />
<!-- Unit and integration test dependencies: -->
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="8.2.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageVersion Include="xunit" Version="2.7.0" />
<!-- Third-party client dependencies to connect and interact with the containers: -->
<PackageVersion Include="Apache.NMS.ActiveMQ" Version="2.1.0" />
<PackageVersion Include="ArangoDBNetStandard" Version="2.0.1" />
<PackageVersion Include="AWSSDK.CloudWatchLogs" Version="3.7.104.14" />
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.101.42" />
<PackageVersion Include="AWSSDK.S3" Version="3.7.103.3" />
<PackageVersion Include="AWSSDK.SimpleNotificationService" Version="3.7.101.7" />
<PackageVersion Include="AWSSDK.SQS" Version="3.7.100.71" />
<PackageVersion Include="Azure.Data.Tables" Version="12.8.0" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.17.0" />
<PackageVersion Include="Azure.Storage.Queues" Version="12.15.0" />
<PackageVersion Include="ClickHouse.Client" Version="6.7.1" />
<PackageVersion Include="Confluent.Kafka" Version="2.0.2" />
<PackageVersion Include="Consul" Version="1.6.10.9" />
<PackageVersion Include="CouchbaseNetClient" Version="3.4.3" />
<PackageVersion Include="DotPulsar" Version="3.3.2" />
<PackageVersion Include="Elastic.Clients.Elasticsearch" Version="8.0.5" />
<PackageVersion Include="EventStore.Client.Grpc.Streams" Version="22.0.0" />
<PackageVersion Include="FirebirdSql.Data.FirebirdClient" Version="10.0.0" />
<PackageVersion Include="Google.Cloud.BigQuery.V2" Version="3.4.0" />
<PackageVersion Include="Google.Cloud.Bigtable.Admin.V2" Version="3.7.0" />
<PackageVersion Include="Google.Cloud.Firestore" Version="3.1.0" />
<PackageVersion Include="Google.Cloud.PubSub.V1" Version="3.5.0" />
<PackageVersion Include="Google.Cloud.Storage.V1" Version="4.6.0" />
<PackageVersion Include="InfluxDB.Client" Version="4.12.0" />
<PackageVersion Include="JanusGraph.Net" Version="1.0.0" />
<PackageVersion Include="Keycloak.Net.Core" Version="1.0.20" />
<PackageVersion Include="KubernetesClient" Version="10.1.4" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.32.1" />
<PackageVersion Include="Microsoft.Azure.Kusto.Data" Version="11.3.3" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.3" />
<PackageVersion Include="Milvus.Client" Version="2.2.2-preview.6" />
<PackageVersion Include="MongoDB.Driver" Version="2.19.0" />
<PackageVersion Include="MyCouch" Version="7.6.0" />
<PackageVersion Include="MySqlConnector" Version="2.2.5" />
<PackageVersion Include="NATS.Client" Version="1.0.8" />
<PackageVersion Include="Neo4j.Driver" Version="5.5.0" />
<PackageVersion Include="Npgsql" Version="6.0.11" />
<PackageVersion Include="Oracle.ManagedDataAccess.Core" Version="3.21.90" />
<PackageVersion Include="RabbitMQ.Client" Version="6.4.0" />
<PackageVersion Include="RavenDB.Client" Version="5.4.100" />
<PackageVersion Include="Selenium.WebDriver" Version="4.8.1" />
<PackageVersion Include="StackExchange.Redis" Version="2.6.90" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion docs/modules/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ await moduleNameContainer.StartAsync();
| Papercut | `jijiechen/papercut:latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.Papercut) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Papercut) |
| PostgreSQL | `postgres:15.1` | [NuGet](https://www.nuget.org/packages/Testcontainers.PostgreSql) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.PostgreSql) |
| PubSub | `gcr.io/google.com/cloudsdktool/google-cloud-cli:446.0.1-emulators` | [NuGet](https://www.nuget.org/packages/Testcontainers.PubSub) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.PubSub) |
| Pulsar | `apachepulsar/pulsar:3.2.3` | [NuGet](https://www.nuget.org/packages/Testcontainers.Pulsar) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Pulsar) |
| Pulsar | `apachepulsar/pulsar:3.0.6` | [NuGet](https://www.nuget.org/packages/Testcontainers.Pulsar) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Pulsar) |
| RabbitMQ | `rabbitmq:3.11` | [NuGet](https://www.nuget.org/packages/Testcontainers.RabbitMq) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.RabbitMq) |
| RavenDB | `ravendb/ravendb:5.4-ubuntu-latest` | [NuGet](https://www.nuget.org/packages/Testcontainers.RavenDb) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.RavenDb) |
| Redis | `redis:7.0` | [NuGet](https://www.nuget.org/packages/Testcontainers.Redis) | [Source](https://github.com/testcontainers/testcontainers-dotnet/tree/develop/src/Testcontainers.Redis) |
Expand Down
2 changes: 1 addition & 1 deletion src/Testcontainers.Pulsar/PulsarBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Testcontainers.Pulsar;
[PublicAPI]
public sealed class PulsarBuilder : ContainerBuilder<PulsarBuilder, PulsarContainer, PulsarConfiguration>
{
public const string PulsarImage = "apachepulsar/pulsar:3.2.3";
public const string PulsarImage = "apachepulsar/pulsar:3.0.6";

public const ushort PulsarBrokerDataPort = 6650;

Expand Down
11 changes: 9 additions & 2 deletions src/Testcontainers.Pulsar/PulsarContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public async Task<string> CreateAuthenticationTokenAsync(TimeSpan expiryTime, Ca
{
int secondsToMilliseconds;

if (_configuration.Image.Tag.StartsWith("3.2") || _configuration.Image.Tag.StartsWith("latest"))
if (_configuration.Image.MatchVersion(IsVersionAffectedByRegression))
{
Logger.LogWarning("The 'apachepulsar/pulsar:3.2.?' image contains a regression. The expiry time is converted to the wrong unit of time: https://github.com/apache/pulsar/issues/22811.");
Logger.LogWarning("The 'apachepulsar/pulsar:3.2.0-3' and '3.3.0' images contains a regression. The expiry time is converted to the wrong unit of time: https://github.com/apache/pulsar/issues/22811.");
secondsToMilliseconds = 1000;
}
else
Expand All @@ -88,6 +88,13 @@ public async Task<string> CreateAuthenticationTokenAsync(TimeSpan expiryTime, Ca
return tokensResult.Stdout;
}

private bool IsVersionAffectedByRegression(System.Version version)
{
return version.Major == 3
&& ((version.Minor == 2 && version.Build is >= 0 and <= 3) ||
(version.Minor == 3 && version.Build == 0));
}

/// <summary>
/// Copies the Pulsar startup script to the container.
/// </summary>
Expand Down

0 comments on commit 39f6e42

Please sign in to comment.