mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-11-17 06:11:06 +01:00
Fix WireMockContainerBuilder (duplicate entries) (#1222)
This commit is contained in:
1 parent
485f7ad952
commit
ab7ce37e7e
7 files changed
+199
-109
No files matched your search
@@ -0,0 +1,19 @@
|
||||
// Copyright © WireMock.Net
|
||||
#if NET6_0_OR_GREATER
|
||||
using System.Runtime.InteropServices;
|
||||
using WireMock.Net.Testcontainers.Utils;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Facts;
|
||||
|
||||
public sealed class RunOnDockerPlatformFact : FactAttribute
|
||||
{
|
||||
public RunOnDockerPlatformFact(string platform)
|
||||
{
|
||||
if (TestcontainersUtils.GetImageOSAsync.Value.Result != OSPlatform.Create(platform))
|
||||
{
|
||||
Skip = $"Only run test when Docker OS Platform {platform} is used.";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -4,9 +4,11 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
using DotNet.Testcontainers.Builders;
|
||||
using FluentAssertions;
|
||||
using FluentAssertions.Execution;
|
||||
using WireMock.Net.Testcontainers;
|
||||
using WireMock.Net.Tests.Facts;
|
||||
using Xunit;
|
||||
|
||||
namespace WireMock.Net.Tests.Testcontainers;
|
||||
@@ -27,7 +29,27 @@ public class TestcontainersTests
|
||||
|
||||
await StartTestAndStopAsync(wireMockContainer);
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/testcontainers/testcontainers-dotnet/issues/1322
|
||||
[RunOnDockerPlatformFact("Linux")]
|
||||
public async Task WireMockContainer_Build_WithNoImageAndNetwork_And_StartAsync_and_StopAsync()
|
||||
{
|
||||
// Act
|
||||
var dummyNetwork = new NetworkBuilder()
|
||||
.WithName("Dummy Network for TestcontainersTests")
|
||||
.WithCleanUp(true)
|
||||
.Build();
|
||||
|
||||
var wireMockContainer = new WireMockContainerBuilder()
|
||||
.WithNetwork(dummyNetwork)
|
||||
.WithWatchStaticMappings(true)
|
||||
.WithAutoRemove(true)
|
||||
.WithCleanUp(true)
|
||||
.Build();
|
||||
|
||||
await StartTestAndStopAsync(wireMockContainer);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WireMockContainer_Build_WithImage_And_StartAsync_and_StopAsync()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user