From 0406f642e8d8b266c2e7b4b1249bee623f4d74a7 Mon Sep 17 00:00:00 2001 From: Stef Heyenrath Date: Mon, 9 Sep 2024 20:28:45 +0200 Subject: [PATCH] IgnoreOnContinuousIntegrationFact --- .../WireMock.Net.Tests/WireMockServerTests.cs | 42 +++++++++---------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/test/WireMock.Net.Tests/WireMockServerTests.cs b/test/WireMock.Net.Tests/WireMockServerTests.cs index e8307530..909ff660 100644 --- a/test/WireMock.Net.Tests/WireMockServerTests.cs +++ b/test/WireMock.Net.Tests/WireMockServerTests.cs @@ -40,7 +40,7 @@ public partial class WireMockServerTests { _testOutputHelper = testOutputHelper; } - + [Fact] public void WireMockServer_Start() { @@ -209,8 +209,8 @@ public partial class WireMockServerTests .Select(addr => addr.Address.ToString()) .ToArray(); } - - [DockerIsRunningInLinuxContainerModeFact] + + [IgnoreOnContinuousIntegrationFact] public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv4() { // Arrange @@ -218,25 +218,23 @@ public partial class WireMockServerTests var IPv4 = GetIPAddressesByFamily(System.Net.Sockets.AddressFamily.InterNetwork); var settings = new WireMockServerSettings { - Urls = new string[] { "http://0.0.0.0:" + port }, + Urls = ["http://0.0.0.0:" + port], }; - var server = WireMockServer.Start(settings); - + using var server = WireMockServer.Start(settings); + server.Given(Request.Create().WithPath("/*")).RespondWith(Response.Create().WithBody("x")); - - foreach (var addr in IPv4) + + foreach (var address in IPv4) { // Act - var response = await new HttpClient().GetStringAsync("http://" + addr + ":" + server.Ports[0] + "/foo").ConfigureAwait(false); - + var response = await new HttpClient().GetStringAsync("http://" + address + ":" + server.Ports[0] + "/foo").ConfigureAwait(false); + // Assert response.Should().Be("x"); - } - - server.Stop(); + } } - [DockerIsRunningInLinuxContainerModeFact] + [IgnoreOnContinuousIntegrationFact] public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv6() { // Arrange @@ -244,25 +242,23 @@ public partial class WireMockServerTests var IPv6 = GetIPAddressesByFamily(System.Net.Sockets.AddressFamily.InterNetworkV6); var settings = new WireMockServerSettings { - Urls = new string[] { "http://0.0.0.0:" + port }, + Urls = ["http://0.0.0.0:" + port], }; - var server = WireMockServer.Start(settings); - + using var server = WireMockServer.Start(settings); + server.Given(Request.Create().WithPath("/*")).RespondWith(Response.Create().WithBody("x")); - foreach (var addr in IPv6) + foreach (var address in IPv6) { // Act - var response = await new HttpClient().GetStringAsync("http://[" + addr + "]:" + server.Ports[0] + "/foo").ConfigureAwait(false); - + var response = await new HttpClient().GetStringAsync("http://[" + address + "]:" + server.Ports[0] + "/foo").ConfigureAwait(false); + // Assert response.Should().Be("x"); } - - server.Stop(); } #endif - + [Fact] public async Task WireMockServer_Should_respond_a_redirect_without_body() {