mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
CI: add Windows Integration Tests for .NET (#1704)
* CI: add Windows Integration Tests for .NET see https://github.com/sshnet/SSH.NET/pull/1702#issuecomment-3342506642 * fix podman setup with Windows and .NET * debug * x * x * x * revert * Run Windows .NET tests in separate job so they run in parallel and we avoid the Common_CreateMoreChannelsThanMaxSessions test failure. * fix coverlet artifacts * fix missing PermitTTY in RemoteSshdConfig Reset this fixes a test failure in Common_CreateMoreChannelsThanMaxSessions when running the tests multiple times against the same SSH server instance. see https://github.com/sshnet/SSH.NET/pull/1704#issuecomment-3343210311 * speed up Windows tests turns out this is caused by DNS resolution taking about 2 seconds on every new connection... * add windows integration tests to Publish needs: --------- Co-authored-by: Rob Hague <rob.hague00@gmail.com> Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Renci.SshNet.IntegrationTests.Common
|
||||
.ClearHostKeyAlgorithms()
|
||||
.ClearPublicKeyAcceptedAlgorithms()
|
||||
.ClearMessageAuthenticationCodeAlgorithms()
|
||||
.PermitTTY(true)
|
||||
.WithUsePAM(true)
|
||||
.Update()
|
||||
.Restart();
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using DotNet.Testcontainers.Builders;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using DotNet.Testcontainers.Builders;
|
||||
using DotNet.Testcontainers.Containers;
|
||||
using DotNet.Testcontainers.Images;
|
||||
|
||||
@@ -28,26 +30,27 @@ namespace Renci.SshNet.IntegrationTests.TestsFixtures
|
||||
|
||||
private IFutureDockerImage _sshServerImage;
|
||||
|
||||
public string SshServerHostName { get; set; }
|
||||
public string SshServerHostName { get; private set; }
|
||||
|
||||
public ushort SshServerPort { get; set; }
|
||||
public ushort SshServerPort { get; private set; }
|
||||
|
||||
public SshUser AdminUser = new SshUser("sshnetadm", "ssh4ever");
|
||||
public SshUser AdminUser { get; } = new SshUser("sshnetadm", "ssh4ever");
|
||||
|
||||
public SshUser User = new SshUser("sshnet", "ssh4ever");
|
||||
public SshUser User { get; } = new SshUser("sshnet", "ssh4ever");
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
// for the .NET Framework Tests in CI, the Container is set up in WSL2 with Podman
|
||||
#if NETFRAMEWORK
|
||||
if (Environment.GetEnvironmentVariable("CI") == "true")
|
||||
#pragma warning disable MA0144 // use System.OperatingSystem to check the current OS
|
||||
// for the Windows Tests in CI, the Container is set up in WSL2 with Podman
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
|
||||
Environment.GetEnvironmentVariable("CI") == "true")
|
||||
#pragma warning restore MA0144 // use System.OperatingSystem to check the current OS
|
||||
{
|
||||
SshServerPort = 2222;
|
||||
SshServerHostName = "localhost";
|
||||
SshServerHostName = "127.0.0.1";
|
||||
await Task.Delay(1_000);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
var containerLogger = _loggerFactory.CreateLogger("testcontainers");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user