Skip to content

WIP: Run tests both on Windows & Linux #1187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
os: Visual Studio 2022
image:
- Visual Studio 2022
- Ubuntu

before_build:
- nuget restore src\Renci.SshNet.sln
- cmd: >-
nuget restore src\Renci.SshNet.sln
- sh: >-
dotnet restore src/Renci.SshNet.sln

build:
project: src\Renci.SshNet.sln
verbosity: minimal

test_script:
- cmd: >-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame
configuration:
- Debug
- Release

for:
-
matrix:
only:
- configuration: Debug

test_script:
- cmd: >-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame

vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net7.0\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame
dotnet test src\Renci.SshNet.Tests\bin\Debug\net7.0\Renci.SshNet.Tests.dll --logger Appveyor --filter "TestCategory!=integration" --blame

- sh: >-
dotnet test src/Renci.SshNet.Tests/bin/Debug/net7.0/Renci.SshNet.Tests.dll --logger Appveyor --filter "TestCategory!=integration" --blame

-
matrix:
only:
- configuration: Release

test_script:
- cmd: >-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Release\net462\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration" --blame

dotnet test src\Renci.SshNet.Tests\bin\Release\net7.0\Renci.SshNet.Tests.dll --logger Appveyor --filter "TestCategory!=integration" --blame

- sh: >-
dotnet test src/Renci.SshNet.Tests/bin/Release/net7.0/Renci.SshNet.Tests.dll --logger Appveyor --filter "TestCategory!=integration" --blame
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void WaitTest()

watch.Stop();

Assert.IsTrue(watch.ElapsedMilliseconds > 200);
Assert.IsTrue(watch.ElapsedMilliseconds >= sleepTime - 5);
Assert.IsTrue(watch.ElapsedMilliseconds < 250);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected sealed override void Arrange()
protected ConnectionInfo CreateConnectionInfo(string hostName)
{
return new ConnectionInfo(hostName,
777,
1027,
"user",
new KeyboardInteractiveAuthenticationMethod("user"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override void SetupData()
var random = new Random();

_connectionInfo = CreateConnectionInfo(IPAddress.Loopback.ToString());
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200));
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(0, 5));
_stopWatch = new Stopwatch();
_actualException = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override void SetupData()
"proxyPwd",
new KeyboardInteractiveAuthenticationMethod("user"))
{
Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200))
Timeout = TimeSpan.FromMilliseconds(random.Next(0, 5))
};
_stopWatch = new Stopwatch();
_actualException = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected override void SetupData()
var random = new Random();

_connectionInfo = new ConnectionInfo(IPAddress.Loopback.ToString(),
777,
1026,
"user",
ProxyTypes.Http,
IPAddress.Loopback.ToString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected override void SetupData()
var random = new Random();

_connectionInfo = new ConnectionInfo(IPAddress.Loopback.ToString(),
777,
1028,
"user",
ProxyTypes.Http,
IPAddress.Loopback.ToString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected sealed override void Arrange()
protected ConnectionInfo CreateConnectionInfo(string proxyUser, string proxyPassword)
{
return new ConnectionInfo(IPAddress.Loopback.ToString(),
777,
1025,
"user",
ProxyTypes.Socks4,
IPAddress.Loopback.ToString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public void ProxyShouldHaveReceivedExpectedSocksRequest()
// CONNECT request
0x01,
// Destination port
0x03,
0x09,
0x04,
0x01,
// Destination address (IPv4)
0x7f,
0x00,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected override void SetupData()
var random = new Random();

_connectionInfo = CreateConnectionInfo("proxyUser", "proxyPwd");
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200));
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(0, 5));
_stopWatch = new Stopwatch();
_clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_actualException = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected override void SetupData()
var random = new Random();

_connectionInfo = CreateConnectionInfo("proxyUser", "proxyPwd");
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200));
_connectionInfo.Timeout = TimeSpan.FromMilliseconds(random.Next(0, 5));
_stopWatch = new Stopwatch();
_actualException = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ConnectAsync_HostNameInvalid_ShouldThrowSocketExceptionWithErr
}
catch (SocketException ex)
{
Assert.AreEqual(SocketError.HostNotFound, ex.SocketErrorCode);
Assert.IsTrue(ex.SocketErrorCode is SocketError.HostNotFound or SocketError.TryAgain, $"Socket error is {ex.SocketErrorCode}");
}
}

Expand All @@ -39,8 +39,8 @@ public async Task ConnectAsync_ProxyHostNameInvalid_ShouldThrowSocketExceptionWi
}
catch (SocketException ex)
{
Assert.AreEqual(SocketError.HostNotFound, ex.SocketErrorCode);
Assert.IsTrue(ex.SocketErrorCode is SocketError.HostNotFound or SocketError.TryAgain, $"Socket error is {ex.SocketErrorCode}");
}
}
}
}
}
1 change: 1 addition & 0 deletions src/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@


<ItemGroup>
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
Expand Down