Skip to content

Commit 58f7dd4

Browse files
committed
fix podman setup with Windows and .NET
1 parent 1ffb637 commit 58f7dd4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using DotNet.Testcontainers.Builders;
1+
using System.Runtime.InteropServices;
2+
3+
using DotNet.Testcontainers.Builders;
24
using DotNet.Testcontainers.Containers;
35
using DotNet.Testcontainers.Images;
46

@@ -38,16 +40,16 @@ private InfrastructureFixture()
3840

3941
public async Task InitializeAsync()
4042
{
41-
// for the .NET Framework Tests in CI, the Container is set up in WSL2 with Podman
42-
#if NETFRAMEWORK
43-
if (Environment.GetEnvironmentVariable("CI") == "true")
43+
#pragma warning disable MA0144 // use System.OperatingSystem to check the current OS
44+
// for the Windows Tests in CI, the Container is set up in WSL2 with Podman
45+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && Environment.GetEnvironmentVariable("CI") == "true")
46+
#pragma warning restore MA0144 // use System.OperatingSystem to check the current OS
4447
{
4548
SshServerPort = 2222;
4649
SshServerHostName = "localhost";
4750
await Task.Delay(1_000);
4851
return;
4952
}
50-
#endif
5153

5254
var containerLogger = _loggerFactory.CreateLogger("testcontainers");
5355

0 commit comments

Comments
 (0)