mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-20 23:41:19 +02:00
Skip unit tests when Docker is not running in Linux container mode using DockerIsRunningInLinuxContainerModeFact
This commit is contained in:
@@ -7,16 +7,16 @@ namespace WireMock.Net.Tests.Facts;
|
||||
|
||||
public sealed class IgnoreOnContinuousIntegrationFact : FactAttribute
|
||||
{
|
||||
private static readonly string _skipReason = "Ignore when run via CI/CD";
|
||||
private static readonly bool _isContinuousIntegrationAzure = bool.TryParse(Environment.GetEnvironmentVariable("TF_BUILD"), out var isTF) && isTF;
|
||||
private static readonly bool _isContinuousIntegrationGithub = bool.TryParse(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), out var isGH) && isGH;
|
||||
private static bool IsContinuousIntegration() => _isContinuousIntegrationAzure || _isContinuousIntegrationGithub;
|
||||
|
||||
private const string SkipReason = "Ignore when run via CI/CD";
|
||||
private static readonly bool IsContinuousIntegrationAzure = bool.TryParse(Environment.GetEnvironmentVariable("TF_BUILD"), out var isTF) && isTF;
|
||||
private static readonly bool IsContinuousIntegrationGithub = bool.TryParse(Environment.GetEnvironmentVariable("GITHUB_ACTIONS"), out var isGH) && isGH;
|
||||
private static readonly bool IsContinuousIntegration = IsContinuousIntegrationAzure || IsContinuousIntegrationGithub;
|
||||
|
||||
public IgnoreOnContinuousIntegrationFact()
|
||||
{
|
||||
if (IsContinuousIntegration())
|
||||
if (IsContinuousIntegration)
|
||||
{
|
||||
Skip = _skipReason;
|
||||
Skip = SkipReason;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public partial class WireMockServerTests
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
[IgnoreOnContinuousIntegrationFact]
|
||||
[DockerIsRunningInLinuxContainerModeFact]
|
||||
public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv4()
|
||||
{
|
||||
// Arrange
|
||||
@@ -236,7 +236,7 @@ public partial class WireMockServerTests
|
||||
server.Stop();
|
||||
}
|
||||
|
||||
[IgnoreOnContinuousIntegrationFact]
|
||||
[DockerIsRunningInLinuxContainerModeFact]
|
||||
public async Task WireMockServer_WithUrl0000_Should_Listen_On_All_IPs_IPv6()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user