mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-24 18:32:13 +01:00
* WireMock.Net.Testcontainers: implement watching the static mapping files + folder for changes * ReloadStaticMappings * fix * . * . * . * . * . * . * . * CopyAsync * <VersionPrefix>1.6.7-preview-02</VersionPrefix> * <VersionPrefix>1.6.7-preview-03</VersionPrefix>
25 lines
965 B
C#
25 lines
965 B
C#
// Copyright © WireMock.Net
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
using DotNet.Testcontainers.Configurations;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WireMock.Net.Testcontainers.Utils;
|
|
|
|
internal static class ContainerUtils
|
|
{
|
|
public static Lazy<Task<OSPlatform>> GetImageOSAsync = new(async () =>
|
|
{
|
|
if (TestcontainersSettings.OS.DockerEndpointAuthConfig == null)
|
|
{
|
|
throw new InvalidOperationException($"The {nameof(TestcontainersSettings.OS.DockerEndpointAuthConfig)} is null. Check if Docker is started.");
|
|
}
|
|
|
|
using var dockerClientConfig = TestcontainersSettings.OS.DockerEndpointAuthConfig.GetDockerClientConfiguration();
|
|
using var dockerClient = dockerClientConfig.CreateClient();
|
|
|
|
var version = await dockerClient.System.GetVersionAsync();
|
|
return version.Os.IndexOf("Windows", StringComparison.OrdinalIgnoreCase) >= 0 ? OSPlatform.Windows : OSPlatform.Linux;
|
|
});
|
|
} |