Skip to content

Commit

Permalink
chore: Apply fix for github.com/apache/pulsar/issues/22811 only for a…
Browse files Browse the repository at this point in the history
…ffected versions (#1232)

Co-authored-by: David Jensen <djn@danskecommodities.com>
Co-authored-by: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 3, 2024
1 parent 5b3d494 commit 934d7f0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<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="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"/>
Expand Down Expand Up @@ -64,4 +64,4 @@
<PackageVersion Include="Selenium.WebDriver" Version="4.8.1"/>
<PackageVersion Include="StackExchange.Redis" Version="2.6.90"/>
</ItemGroup>
</Project>
</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.MsSql/MsSqlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public Task<bool> UntilAsync(IContainer container)
}

/// <inheritdoc cref="IWaitUntil.UntilAsync" />
private async Task<bool> UntilAsync(MsSqlContainer container)
private static async Task<bool> UntilAsync(MsSqlContainer container)
{
var sqlCmdFilePath = await container.GetSqlCmdFilePathAsync()
.ConfigureAwait(false);
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
9 changes: 7 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(IsVersionAffectedByGhIssue22811))
{
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 Down Expand Up @@ -118,4 +118,9 @@ internal Task CopyStartupScriptAsync(CancellationToken ct = default)

return CopyAsync(Encoding.Default.GetBytes(startupScript.ToString()), PulsarBuilder.StartupScriptFilePath, Unix.FileMode755, ct);
}

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

0 comments on commit 934d7f0

Please sign in to comment.