Skip to content

Commit

Permalink
Merge pull request #475 from HofmeisterAn/feature/update-testcontaine…
Browse files Browse the repository at this point in the history
…rs-dotnet

feat: Update Testcontainers for .NET
  • Loading branch information
Zelldon committed Dec 16, 2022
2 parents 1329bde + 6a6e68d commit 286932d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Client.IntegrationTests/Client.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DotNet.Testcontainers" Version="1.5.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.19" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="5.1.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.2.0" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="TestContainers" Version="0.0.2.107" />
<PackageReference Include="TestContainers" Version="2.3.0" />
<PackageReference Update="StyleCop.Analyzers" Version="1.1.118" />
</ItemGroup>

Expand Down
19 changes: 9 additions & 10 deletions Client.IntegrationTests/ZeebeIntegrationTestHelper.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using DotNet.Testcontainers.Containers.Builders;
using DotNet.Testcontainers.Containers.Configurations;
using DotNet.Testcontainers.Containers.Modules;
using DotNet.Testcontainers.Builders;
using DotNet.Testcontainers.Containers;
using DotNet.Testcontainers.Images;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using TestContainers.Core.Builders;
using TestContainers.Core.Containers;
using Zeebe.Client;

namespace Client.IntegrationTests
Expand All @@ -17,7 +14,9 @@ public class ZeebeIntegrationTestHelper
{
public const string LatestVersion = "1.2.4";

private TestcontainersContainer container;
public const ushort ZeebePort = 26500;

private ITestcontainersContainer container;
private IZeebeClient client;

private readonly string version;
Expand Down Expand Up @@ -65,8 +64,8 @@ public async Task TearDownIntegrationTest()
private TestcontainersContainer CreateZeebeContainer()
{
return new TestcontainersBuilder<TestcontainersContainer>()
.WithImage("camunda/zeebe:" + version)
.WithPortBinding(26500)
.WithImage(new DockerImage("camunda", "zeebe", version))
.WithPortBinding(ZeebePort, true)
.WithEnvironment("ZEEBE_BROKER_CLUSTER_PARTITIONSCOUNT", count.ToString())
.Build();
}
Expand All @@ -82,7 +81,7 @@ private IZeebeClient CreateZeebeClient()
loggingBuilder.AddNLog(path);
});

var host = "0.0.0.0:" + container.GetMappedPublicPort(26500);
var host = container.Hostname + ":" + container.GetMappedPublicPort(ZeebePort);

return ZeebeClient.Builder()
.UseLoggerFactory(loggerFactory)
Expand Down

0 comments on commit 286932d

Please sign in to comment.