Merge branch 'master' into MappingSerializer

This commit is contained in:
Stef Heyenrath
2025-12-21 09:50:09 +01:00
2 changed files with 26 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ using Xunit.Abstractions;
namespace WireMock.Net.Tests.Testcontainers;
public partial class TestcontainersTests(ITestOutputHelper testOutputHelper)
public class TestcontainersTests(ITestOutputHelper testOutputHelper)
{
[Fact]
public async Task WireMockContainer_Build_And_StartAsync_and_StopAsync()

View File

@@ -15,10 +15,12 @@ using WireMock.Constants;
using WireMock.Net.Testcontainers;
using WireMock.Util;
using Xunit;
using Xunit.Abstractions;
namespace WireMock.Net.Tests.Testcontainers;
public partial class TestcontainersTests
[Collection("Grpc")]
public class TestcontainersTestsGrpc(ITestOutputHelper testOutputHelper)
{
[Fact]
public async Task WireMockContainer_Build_Grpc_TestPortsAndUrls1()
@@ -169,6 +171,28 @@ public partial class TestcontainersTests
await StopAsync(wireMockContainer);
}
private async Task StopAsync(WireMockContainer wireMockContainer)
{
try
{
await wireMockContainer.StopAsync();
}
catch (Exception ex)
{
// Sometimes we get this exception, so for now ignore it.
/*
Failed WireMock.Net.Tests.Testcontainers.TestcontainersTests.WireMockContainer_Build_WithImageAsText_And_StartAsync_and_StopAsync [9 s]
Error Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at DotNet.Testcontainers.Containers.DockerContainer.UnsafeStopAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 567
at DotNet.Testcontainers.Containers.DockerContainer.StopAsync(CancellationToken ct) in /_/src/Testcontainers/Containers/DockerContainer.cs:line 319
*/
testOutputHelper.WriteLine($"Exception during StopAsync: {ex}");
}
}
private static async Task<WireMockContainer> Given_WireMockContainerIsStartedForHttpAndGrpcAsync()
{
var port = PortUtils.FindFreeTcpPort();