-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Mono compatibility verification #2311
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,12 +116,6 @@ Target "Build" <| fun _ -> | |
|> MSBuildRelease "" "Rebuild" | ||
|> ignore | ||
|
||
Target "BuildMono" <| fun _ -> | ||
|
||
!!"src/Akka.sln" | ||
|> MSBuild "" "Rebuild" [("Configuration","Release Mono")] | ||
|> ignore | ||
|
||
//-------------------------------------------------------------------------------- | ||
// Build the docs | ||
Target "Docs" <| fun _ -> | ||
|
@@ -157,7 +151,7 @@ Target "AzureDocsDeploy" (fun _ -> | |
pushToAzure docDir azureUrl "stable" azureKey 3 | ||
pushToAzure docDir azureUrl release.NugetVersion azureKey 3 | ||
if(not canPush) then | ||
printfn "Missing required paraments to push docs to Azure. Run build HelpDocs to find out!" | ||
printfn "Missing required parameters to push docs to Azure. Run build HelpDocs to find out!" | ||
|
||
) | ||
|
||
|
@@ -241,6 +235,19 @@ Target "BuildRelease" DoNothing | |
// Tests targets | ||
//-------------------------------------------------------------------------------- | ||
|
||
//-------------------------------------------------------------------------------- | ||
// Filter out assemblies which can't run on Linux, Mono, .NET Core, etc... | ||
|
||
open Fake.EnvironmentHelper | ||
let filterPlatformSpecificAssemblies (assembly:string) = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Platform-specific filter for specs inside FAKE. Allows us to run the same FAKE file for multiple platforms and skip tests that can't run due to environmental issues on a particular platform. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine, but there's more elegant pattern (for the future): let (|Contains|_|) pattern (assembly: string) = if assembly.Contains pattern then Some () else None
// usage
match assembly with
| Contains "Sqlite" when isMono -> false
| _ -> true There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, I'll leave it as-is for now in case someone wants a test that isn't just |
||
match assembly with | ||
| assembly when (assembly.Contains("Sqlite") && isMono) -> false | ||
| assembly when (assembly.Contains(".API") && isMono) -> false | ||
| assembly when (assembly.Contains("Akka.Remote.TestKit.Tests") && isMono) -> false | ||
| assembly when (assembly.Contains("Akka.Persistence.TestKit.Tests") && isMono) -> false | ||
| assembly when (assembly.Contains("Akka.Streams.Tests.TCK") && isMono) -> false | ||
| _ -> true | ||
|
||
//-------------------------------------------------------------------------------- | ||
// Clean test output | ||
|
||
|
@@ -251,13 +258,16 @@ Target "CleanTests" <| fun _ -> | |
|
||
open Fake.Testing | ||
Target "RunTests" <| fun _ -> | ||
let xunitTestAssemblies = !! "src/**/bin/Release/*.Tests.dll" -- | ||
let xunitTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! "src/**/bin/Release/*.Tests.dll" -- | ||
// Akka.Streams.Tests is referencing Akka.Streams.TestKit.Tests | ||
"src/**/Akka.Streams.Tests/bin/Release/Akka.Streams.TestKit.Tests.dll" -- | ||
// Akka.Streams.Tests.Performance is referencing Akka.Streams.Tests and Akka.Streams.TestKit.Tests | ||
"src/**/Akka.Streams.Tests.Performance/bin/Release/*.Tests.dll" | ||
"src/**/Akka.Streams.Tests.Performance/bin/Release/*.Tests.dll") | ||
|
||
let nunitTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! "src/**/bin/Release/Akka.Streams.Tests.TCK.dll") | ||
|
||
let nunitTestAssemblies = !! "src/**/bin/Release/Akka.Streams.Tests.TCK.dll" | ||
// Debug output | ||
xunitTestAssemblies |> Seq.iter (printfn "Executing: %s") | ||
|
||
mkdir testOutput | ||
|
||
|
@@ -268,35 +278,20 @@ Target "RunTests" <| fun _ -> | |
let runSingleAssembly assembly = | ||
let assemblyName = Path.GetFileNameWithoutExtension(assembly) | ||
xUnit2 | ||
(fun p -> { p with XmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.xml"); HtmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.HTML"); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization }) | ||
(fun p -> { p with XmlOutputPath = Some (testOutput @@ (assemblyName + "_xunit.xml")); HtmlOutputPath = Some (testOutput @@ (assemblyName + "_xunit.html")); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization; NoAppDomain = true; ForceTeamCity = true; }) | ||
(Seq.singleton assembly) | ||
|
||
xunitTestAssemblies |> Seq.iter (runSingleAssembly) | ||
|
||
let runNunitSingleAssembly assembly = | ||
let assemblyName = Path.GetFileNameWithoutExtension(assembly) | ||
NUnit3 | ||
(fun p -> { p with ToolPath = nunitToolPath; WorkingDir = testOutput}) | ||
(fun p -> { p with ToolPath = nunitToolPath; WorkingDir = testOutput; TeamCity = true;}) | ||
(Seq.singleton assembly) | ||
|
||
printfn "Using NUnit runner: %s" nunitToolPath | ||
nunitTestAssemblies |> Seq.iter (runNunitSingleAssembly) | ||
|
||
Target "RunTestsMono" <| fun _ -> | ||
let xunitTestAssemblies = !! "src/**/bin/Release Mono/*.Tests.dll" | ||
|
||
mkdir testOutput | ||
|
||
let xunitToolPath = findToolInSubPath "xunit.console.exe" "src/packages/xunit.runner.console*/tools" | ||
printfn "Using XUnit runner: %s" xunitToolPath | ||
let runSingleAssembly assembly = | ||
let assemblyName = Path.GetFileNameWithoutExtension(assembly) | ||
xUnit2 | ||
(fun p -> { p with XmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.xml"); HtmlOutputPath = Some (testOutput + @"\" + assemblyName + "_xunit.HTML"); ToolPath = xunitToolPath; TimeOut = System.TimeSpan.FromMinutes 30.0; Parallel = ParallelMode.NoParallelization }) | ||
(Seq.singleton assembly) | ||
|
||
xunitTestAssemblies |> Seq.iter (runSingleAssembly) | ||
|
||
|
||
(* Debug helper for troubleshooting an issue we had when we were running multi-node tests multiple times *) | ||
Target "PrintMultiNodeTests" <| fun _ -> | ||
|
@@ -309,7 +304,7 @@ Target "PrintMultiNodeTests" <| fun _ -> | |
|
||
Target "MultiNodeTests" <| fun _ -> | ||
mkdir testOutput | ||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" "bin/core/Akka.MultiNodeTestRunner*" | ||
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "bin" @@ "core" @@ "Akka.MultiNodeTestRunner*") | ||
let multiNodeTestAssemblies = !! "src/**/bin/Release/Akka.Remote.Tests.MultiNode.dll" ++ | ||
"src/**/bin/Release/Akka.Cluster.Tests.MultiNode.dll" ++ | ||
"src/**/bin/Release/Akka.Cluster.Tools.Tests.MultiNode.dll" | ||
|
@@ -344,7 +339,7 @@ Target "NBench" <| fun _ -> | |
|
||
mkdir perfOutput | ||
let nbenchTestPath = findToolInSubPath "NBench.Runner.exe" "src/packges/NBench.Runner*" | ||
let nbenchTestAssemblies = !! testSearchPath | ||
let nbenchTestAssemblies = Seq.filter filterPlatformSpecificAssemblies (!! testSearchPath) | ||
printfn "Using NBench.Runner: %s" nbenchTestPath | ||
|
||
let runNBench assembly = | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,7 +152,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.TestKit.Xunit", "contr | |
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependencyInjection", "DependencyInjection", "{B1D10183-8FAE-4506-B935-403FCED89BDB}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.Core", "contrib\dependencyInjection\Akka.DI.Core\Akka.DI.Core.csproj", "{FDF09D18-B68E-4B95-B1F6-B89D9C6C3AE9}" | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.Core", "contrib\dependencyinjection\Akka.DI.Core\Akka.DI.Core.csproj", "{FDF09D18-B68E-4B95-B1F6-B89D9C6C3AE9}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Had to fix capitalization of name or Linux builds fail. |
||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence", "{264C22A4-CAFC-41F6-B82C-4DDC5C196767}" | ||
EndProject | ||
|
@@ -164,7 +164,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TcpEchoService", "TcpEchoSe | |
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TcpEchoService.Server", "examples\TcpEchoService.Server\TcpEchoService.Server.csproj", "{825196A4-4B08-401F-8994-E2DB7C77A8B7}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.TestKit", "contrib\dependencyInjection\Akka.DI.TestKit\Akka.DI.TestKit.csproj", "{D8DB14A5-6147-4512-BF5C-683FDCA6190C}" | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Akka.DI.TestKit", "contrib\dependencyinjection\Akka.DI.TestKit\Akka.DI.TestKit.csproj", "{D8DB14A5-6147-4512-BF5C-683FDCA6190C}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestKit", "TestKit", "{46116E52-BF96-4B76-8C81-2104C74487DF}" | ||
EndProject | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4929,6 +4929,10 @@ namespace Akka.Util | |
public override bool IsRight { get; } | ||
public TB Value { get; } | ||
} | ||
public class static RuntimeDetector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New class used to detect runtimes. Decided to unify all of our Mono detector implementations into a single static utility class. |
||
{ | ||
public static readonly bool IsMono; | ||
} | ||
public class static StandardOutWriter | ||
{ | ||
public static void Write(string message, System.Nullable<System.ConsoleColor> foregroundColor = null, System.Nullable<System.ConsoleColor> backgroundColor = null) { } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -392,7 +392,15 @@ protected override void OnReceive(object message) | |
|
||
protected override void PostStop() | ||
{ | ||
RemoteConnection.Shutdown(_connection); | ||
try | ||
{ | ||
RemoteConnection.Shutdown(_connection); | ||
RemoteConnection.ReleaseAll().Wait(_settings.ConnectTimeout); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Safe disposal of MNTR resources. |
||
} | ||
catch (Exception ex) | ||
{ | ||
_log.Error(ex, "Error while terminating RemoteConnection."); | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
using Akka.Util.Internal; | ||
using Xunit; | ||
using System.Net; | ||
using static Akka.Util.RuntimeDetector; | ||
|
||
namespace Akka.Remote.Tests | ||
{ | ||
|
@@ -70,8 +71,7 @@ public void Remoting_should_contain_correct_configuration_values_in_ReferenceCon | |
public void Remoting_should_be_able_to_parse_AkkaProtocol_related_config_elements() | ||
{ | ||
var settings = new AkkaProtocolSettings(((RemoteActorRefProvider)((ExtendedActorSystem)Sys).Provider).RemoteSettings.Config); | ||
|
||
//TODO fill this in when we add secure cookie support | ||
|
||
Assert.Equal(typeof(DeadlineFailureDetector), Type.GetType(settings.TransportFailureDetectorImplementationClass)); | ||
Assert.Equal(TimeSpan.FromSeconds(4), settings.TransportHeartBeatInterval); | ||
Assert.Equal(TimeSpan.FromSeconds(20), settings.TransportFailureDetectorConfig.GetTimeSpan("acceptable-heartbeat-pause")); | ||
|
@@ -103,7 +103,7 @@ public void Remoting_should_contain_correct_heliosTCP_values_in_ReferenceConf() | |
[Fact] | ||
public void When_remoting_works_in_Mono_ip_enforcement_should_be_defaulted_to_true() | ||
{ | ||
HeliosTransportSettings.IsMono = true; | ||
if (!IsMono) return; // skip IF NOT using Mono | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mono 4.4.2 can't handle dual-mode sockets correctly, so we have to force the socket to use IPV4 OR IPV6, not "either." We check inside our |
||
var c = ((RemoteActorRefProvider)((ActorSystemImpl)Sys).Provider).RemoteSettings.Config.GetConfig("akka.remote.helios.tcp"); | ||
var s = new HeliosTransportSettings(c); | ||
|
||
|
@@ -113,7 +113,7 @@ public void When_remoting_works_in_Mono_ip_enforcement_should_be_defaulted_to_tr | |
[Fact] | ||
public void When_remoting_works_not_in_Mono_ip_enforcement_should_be_defaulted_to_false() | ||
{ | ||
HeliosTransportSettings.IsMono = false; | ||
if (IsMono) return; // skip IF using Mono | ||
var c = ((RemoteActorRefProvider)((ActorSystemImpl)Sys).Provider).RemoteSettings.Config.GetConfig("akka.remote.helios.tcp"); | ||
var s = new HeliosTransportSettings(c); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mono-friendly implementation of NBench runner.