Test Testcontainers ConsoleApp on Linux (#1547)

* Test Testcontainers ConsoleApp on Linux

* fix
This commit is contained in:
Stef Heyenrath authored and GitHub committed 2026-11-20 17:48:55 +01:00
1 parent 3674007295
commit 96c5fcae8e
6 files changed
+113 -2

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
name: Run Testcontainers ConsoleApp
on:
pull_request:
branches:
- '**'
push:
branches:
- 'main'
permissions:
contents: read
jobs:
linux-testcontainers:
name: Test Testcontainers ConsoleApp on Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup .NET 10
uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5
with:
dotnet-version: 10.0.x
- name: Update Testcontainers to the latest stable version
run: |
CSPROJ='./test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj'
LATEST=$(curl -fsSL https://api.nuget.org/v3-flatcontainer/testcontainers/index.json \
| jq -r '[.versions[] | select(contains("-") | not)] | last')
if [ -z "$LATEST" ] || [ "$LATEST" = "null" ]; then
echo "Could not determine the latest Testcontainers version"
exit 1
fi
echo "Latest Testcontainers version: $LATEST"
sed -i -E "s|(<PackageReference Include=\"Testcontainers\" Version=\")[^\"]+(\")|\1${LATEST}\2|" "$CSPROJ"
grep 'Include="Testcontainers"' "$CSPROJ"
- name: Build WireMock.Net.Testcontainers.ConsoleApp
run: dotnet build './test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj' -c Release
- name: Run WireMock.Net.Testcontainers.ConsoleApp
run: dotnet run --project './test/WireMock.Net.Testcontainers.ConsoleApp/WireMock.Net.Testcontainers.ConsoleApp.csproj' -c Release --no-build
+15
View File
@@ -154,6 +154,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Service", "exa
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Console", "examples\WireMock.Net.Console\WireMock.Net.Console.csproj", "{1B2D0EF9-A494-400C-91CF-651249B2BA0B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WireMock.Net.Testcontainers.ConsoleApp", "test\WireMock.Net.Testcontainers.ConsoleApp\WireMock.Net.Testcontainers.ConsoleApp.csproj", "{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -848,6 +850,18 @@ Global
{1B2D0EF9-A494-400C-91CF-651249B2BA0B}.Release|x64.Build.0 = Release|Any CPU
{1B2D0EF9-A494-400C-91CF-651249B2BA0B}.Release|x86.ActiveCfg = Release|Any CPU
{1B2D0EF9-A494-400C-91CF-651249B2BA0B}.Release|x86.Build.0 = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|x64.ActiveCfg = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|x64.Build.0 = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|x86.ActiveCfg = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Debug|x86.Build.0 = Debug|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|Any CPU.Build.0 = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|x64.ActiveCfg = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|x64.Build.0 = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|x86.ActiveCfg = Release|Any CPU
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -912,6 +926,7 @@ Global
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890} = {8F890C6F-9ACC-438D-928A-AD61CDA862F2}
{7F0B2446-0363-4720-AF46-F47F83B557DC} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{1B2D0EF9-A494-400C-91CF-651249B2BA0B} = {985E0ADB-D4B4-473A-AA40-567E279B7946}
{78DC9D02-D673-4CF2-AFF6-25A4E2E72886} = {0BB8B634-407A-4610-A91F-11586990767A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC539027-9852-430C-B19F-FD035D018458}
@@ -189,7 +189,7 @@ internal class Program
private static async Task TestAsync(string? image = null)
{
var mappingsPath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "WireMock.Net.Console.NET6", "__admin", "mappings");
var mappingsPath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "WireMock.Net.Console.NET8", "__admin", "mappings");
var dummyNetwork = new NetworkBuilder()
.WithName($"Dummy Network for {image ?? "null"}")
@@ -39,7 +39,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Stef.Validation" Version="0.3.0" />
<PackageReference Include="Testcontainers" Version="4.14.0" />
<PackageReference Include="Testcontainers" Version="4.17.0" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,34 @@
// Copyright © WireMock.Net
using WireMock.Net.Testcontainers;
namespace WireMock.Net.TestContainers.ConsoleApp;
/// <summary>
/// Test if WireMock.Net.Testcontainers is compatible with the latest version of Testcontainers for .NET
/// </summary>
internal class Program
{
private static async Task<int> Main(string[] args)
{
try
{
await TestAsync();
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex);
return 1;
}
}
private static async Task TestAsync()
{
var builder = new WireMockContainerBuilder()
.WithLinuxImage()
.WithWatchStaticMappings(true);
_ = builder.Build();
}
}
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Testcontainers" Version="4.17.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\WireMock.Net.Testcontainers\WireMock.Net.Testcontainers.csproj" />
</ItemGroup>
</Project>