mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Allow the integration tests to run on .NET Framework (#1286)
* Allow the integration tests to run on .NET Framework * Update appveyor.yml * Update appveyor.yml --------- Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
This commit is contained in:
+3
-2
@@ -19,13 +19,14 @@ for:
|
||||
|
||||
build_script:
|
||||
- echo build
|
||||
- dotnet build Renci.SshNet.sln -c Debug -f net8.0
|
||||
- dotnet build -f net8.0 -c Debug test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
|
||||
- dotnet build -f net8.0 -c Debug test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
|
||||
|
||||
test_script:
|
||||
- sh: echo "Run unit tests"
|
||||
- sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_unit_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_unit_test_net_8_coverage.xml test/Renci.SshNet.Tests/Renci.SshNet.Tests.csproj
|
||||
- sh: echo "Run integration tests"
|
||||
- sh: dotnet test -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
|
||||
- sh: dotnet test -f net8.0 -c Debug --no-restore --no-build --results-directory artifacts --logger Appveyor --logger "console;verbosity=normal" --logger "liquid.md;LogFileName=linux_integration_test_net_8_report.md" -p:CollectCoverage=true -p:CoverletOutputFormat=cobertura -p:CoverletOutput=../../artifacts/linux_integration_test_net_8_coverage.xml test/Renci.SshNet.IntegrationTests/Renci.SshNet.IntegrationTests.csproj
|
||||
|
||||
# on_failure:
|
||||
# - sh: appveyor PushArtifact artifacts/tcpdump.pcap
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<trace autoflush="true"/>
|
||||
<sources>
|
||||
<source name="SshNet.Logging" switchName="SshNetSwitch" switchType="System.Diagnostics.SourceSwitch">
|
||||
<listeners>
|
||||
<!--<add name="SshDotNetTraceFile" />-->
|
||||
<!--<add name="Console"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="SshNetSwitch" value="Verbose"/>
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="SshDotNetTraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="SshNetTrace.log">
|
||||
<!--<filter type="System.Diagnostics.EventTypeFilter" initializeData="Warning" />-->
|
||||
</add>
|
||||
<add name="Console" type="System.Diagnostics.ConsoleTraceListener" traceOutputOptions="DateTime,Timestamp,ThreadId"/>
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
</configuration>
|
||||
@@ -4,9 +4,7 @@
|
||||
{
|
||||
public static DateTime TruncateToWholeSeconds(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.AddMilliseconds(-dateTime.Millisecond)
|
||||
.AddMicroseconds(-dateTime.Microsecond)
|
||||
.AddTicks(-(dateTime.Nanosecond / 100));
|
||||
return new DateTime(dateTime.Ticks - (dateTime.Ticks % TimeSpan.TicksPerSecond), dateTime.Kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ namespace Renci.SshNet.IntegrationTests
|
||||
while ((line = sr.ReadLine()) != null)
|
||||
{
|
||||
// skip comments
|
||||
#if NET
|
||||
if (line.StartsWith('#'))
|
||||
#else
|
||||
if (line.StartsWith("#"))
|
||||
#endif
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
#if !NET6_0_OR_GREATER
|
||||
using System.Net;
|
||||
#endif
|
||||
|
||||
using Renci.SshNet.Common;
|
||||
|
||||
@@ -46,8 +49,8 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
#else
|
||||
var request = (HttpWebRequest) WebRequest.Create(url);
|
||||
var response = (HttpWebResponse) request.GetResponse();
|
||||
var request = (HttpWebRequest) WebRequest.Create(url);
|
||||
var response = (HttpWebResponse) request.GetResponse();
|
||||
#endif // NET6_0_OR_GREATER
|
||||
|
||||
Assert.IsNotNull(response);
|
||||
@@ -122,10 +125,10 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
var data = ReadStream(response.Content.ReadAsStream());
|
||||
#else
|
||||
var request = (HttpWebRequest) WebRequest.Create("http://localhost:8084");
|
||||
using (var response = (HttpWebResponse) request.GetResponse())
|
||||
{
|
||||
var data = ReadStream(response.GetResponseStream());
|
||||
var request = (HttpWebRequest) WebRequest.Create("http://localhost:8084");
|
||||
using (var response = (HttpWebResponse) request.GetResponse())
|
||||
{
|
||||
var data = ReadStream(response.GetResponseStream());
|
||||
#endif // NET6_0_OR_GREATER
|
||||
var end = DateTime.Now;
|
||||
|
||||
|
||||
@@ -14,7 +14,11 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
using (FileStream file = new FileStream(fileName, FileMode.Open))
|
||||
{
|
||||
var hash = MD5.HashData(file);
|
||||
byte[] hash;
|
||||
using (var md5 = MD5.Create())
|
||||
{
|
||||
hash = md5.ComputeHash(file);
|
||||
}
|
||||
|
||||
file.Close();
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace Renci.SshNet.IntegrationTests
|
||||
{
|
||||
class Program
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
private static void Main()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFrameworks>net48;net8.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<NoWarn>$(NoWarn);SYSLIB0021;SYSLIB1045;SYSLIB0014;IDE0220;IDE0010</NoWarn>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoWarn>$(NoWarn);SYSLIB0021;SYSLIB1045</NoWarn>
|
||||
|
||||
@@ -329,7 +329,7 @@ namespace Renci.SshNet.TestTools.OpenSSH
|
||||
sshdConfig.KeyboardInteractiveAuthentication = ToBool(value);
|
||||
break;
|
||||
case "LogLevel":
|
||||
sshdConfig.LogLevel = Enum.Parse<LogLevel>(value, ignoreCase: true);
|
||||
sshdConfig.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), value, ignoreCase: true);
|
||||
break;
|
||||
case "Subsystem":
|
||||
sshdConfig.Subsystems.Add(Subsystem.FromConfig(value));
|
||||
|
||||
Reference in New Issue
Block a user