Skip to content
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

Add cross-platform spec test to MNTR #2919

Merged
merged 71 commits into from
Aug 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b2b022a
Port SocketChannel for core. Add TAP to APM async model converter ext…
Arkatufus Jul 6, 2017
0306ac6
Convert Net45 code convention to Core (mainly Assembly related)
Arkatufus Jul 6, 2017
ab52532
Add missing methods and classes that are no longer available in Core
Arkatufus Jul 6, 2017
e85bb90
Fix run shutdown spec so that it runs properly
Arkatufus Jul 6, 2017
41220b8
Remove Faker dependency by moving all related methods
Arkatufus Jul 6, 2017
4f42a03
Add core frameworks to projects csproj that are required by MultiNode…
Arkatufus Jul 6, 2017
8da5406
Add AKKAIO constant to Akka because it is needed by NodeTestRunner
Arkatufus Jul 6, 2017
9f1154d
Port SocketChannel for core. Add TAP to APM async model converter ext…
Arkatufus Jul 6, 2017
d7d0415
Convert Net45 code convention to Core (mainly Assembly related)
Arkatufus Jul 6, 2017
47b02cf
Add missing methods and classes that are no longer available in Core
Arkatufus Jul 6, 2017
a281741
Fix run shutdown spec so that it runs properly
Arkatufus Jul 6, 2017
5c83351
Remove Faker dependency by moving all related methods
Arkatufus Jul 6, 2017
48ee5fc
Add core frameworks to projects csproj that are required by MultiNode…
Arkatufus Jul 6, 2017
a90d3d5
Add AKKAIO constant to Akka because it is needed by NodeTestRunner
Arkatufus Jul 6, 2017
d875d3c
Change buildIncremental.fsx to include Akka.MultiNodeTestRunner.Share…
Arkatufus Jul 6, 2017
338f38e
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 7, 2017
d921313
Combine compiler conditions that can be merged for both platform
Arkatufus Jul 7, 2017
acae241
TestCaseDiscoveryMessage.TestAssembly.Assembly have different behavio…
Arkatufus Jul 7, 2017
7716940
Turn on Akka.Remote.Testkit.Tests NetCore build because Akka.Remote.T…
Arkatufus Jul 7, 2017
9eaf62a
Remove code optimization, not needed in tests
Arkatufus Jul 7, 2017
7799f1d
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 7, 2017
9aeb38b
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 11, 2017
fdfe655
Move SpecPass, SpecFail, and Discovery class to Akka.MultiNodeTestRun…
Arkatufus Jul 12, 2017
d5eb8c5
Remove Akka.MultiNodeTestRunner and Akka.NodeTestRunner reference fro…
Arkatufus Jul 12, 2017
87e3ccc
Rollback unnescessary NetCore implementation
Arkatufus Jul 12, 2017
edc0795
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 12, 2017
25c9862
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Danthar Jul 13, 2017
ffabcfa
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 13, 2017
f01744a
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 14, 2017
826558a
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 14, 2017
bf3be4d
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 15, 2017
a16f918
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 19, 2017
f59c52b
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 22, 2017
0e82d04
Add `NetCore` support to NTR and MNTR
Arkatufus Jul 23, 2017
48fa8fa
Simple source clean-up
Arkatufus Jul 23, 2017
b577bb3
Compile all MultiNode projects in `NetCore`
Arkatufus Jul 27, 2017
3a6bf7d
Add -Dmultinode.platform aprogram argument to support `NetCore` based…
Arkatufus Jul 27, 2017
cef7aa5
Add `NetCore` MNTR test in build script
Arkatufus Jul 27, 2017
192bb01
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 27, 2017
651ef28
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
heynickc Jul 27, 2017
c24c895
Remove MultiNodeSpec.GetCallerName static function because it is prac…
Arkatufus Jul 27, 2017
943b04e
Fix failing multi node spec
Arkatufus Jul 27, 2017
9fd1fb8
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 27, 2017
3be0f22
Fix RemoteRestartedQuarantinedSpec
Arkatufus Jul 28, 2017
06feba4
Fix, failed to load certain assembly in Discovery
Arkatufus Jul 29, 2017
584a7ec
Add missing project reference in MNTR.shared test
Arkatufus Jul 29, 2017
4e6e05d
Expose error reporting on discovery failed. Was swallowed by Xunit.
Arkatufus Jul 29, 2017
5111fd8
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 29, 2017
20eddde
Fix erroneous json and html target file name.
Arkatufus Jul 29, 2017
1f37baf
Change Discovery.Tests to List<List<NodeTest>> because of possible ke…
Arkatufus Jul 29, 2017
30e3689
Change sharding multinode test structure to follow proper test file c…
Arkatufus Jul 29, 2017
68d770d
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Jul 29, 2017
c09f019
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
heynickc Jul 31, 2017
6dee7d4
Revert MNTR.Discovery.Tests back to dictionary, needed for unit test
Arkatufus Jul 31, 2017
b8c948b
Add initial cross-platform spec support
Arkatufus Aug 1, 2017
92437da
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Aug 1, 2017
1114d26
Revert "Add initial cross-platform spec support"
Arkatufus Aug 1, 2017
d9d7704
Initial commit
Arkatufus Aug 1, 2017
f7ea438
Merge branch 'v1.3' into Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828
Arkatufus Aug 3, 2017
a598537
Merge branch 'v1.3' into MNTR_cross-platform_spec
Arkatufus Aug 3, 2017
e50e68c
20 second wait for Controller actor terminate
heynickc Aug 3, 2017
a6d2931
Merge pull request #1 from heynickc/arkatafus-controllerspec
Arkatufus Aug 3, 2017
f2a3515
Merge remote-tracking branch 'upstream/v1.3' into MNTR_cross-platform…
Arkatufus Aug 3, 2017
7c5751f
Merge remote-tracking branch 'upstream/v1.3' into Fix_Akka.MultiTestN…
Arkatufus Aug 3, 2017
84dfd8c
Finalize 1.3 merging
Arkatufus Aug 3, 2017
3a495cd
Merge branch 'Fix_Akka.MultiTestNodeRunner.Shared.Tests_#2828' into M…
Arkatufus Aug 3, 2017
96f354b
Merge branch 'v1.3' into MNTR_cross-platform_spec
Arkatufus Aug 3, 2017
dd3cb70
Merge branch 'v1.3' into MNTR_cross-platform_spec
Arkatufus Aug 4, 2017
631d199
Merge branch 'v1.3' into MNTR_cross-platform_spec
Arkatufus Aug 4, 2017
74174dc
Merge branch 'v1.3' into MNTR_cross-platform_spec
Aaronontheweb Aug 4, 2017
c28c3f6
Merge branch 'v1.3' into MNTR_cross-platform_spec
Aaronontheweb Aug 4, 2017
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,20 @@ protected override void HandleNodeMessageFragment(LogMessageFragmentForNode logM

protected override void HandleNodeSpecPass(NodeCompletedSpecWithSuccess nodeSuccess)
{
Console.ForegroundColor = ConsoleColor.Green;
_teamCityTestWriter?.WriteStdOutput(
$"[NODE{nodeSuccess.NodeIndex}:{nodeSuccess.NodeRole}][{DateTime.UtcNow.ToShortTimeString()}]: SPEC PASSED: {nodeSuccess.Message}");

Console.ResetColor();

base.HandleNodeSpecPass(nodeSuccess);
}

protected override void HandleNodeSpecFail(NodeCompletedSpecWithFail nodeFail)
{
Console.ForegroundColor = ConsoleColor.Red;
_teamCityTestWriter?.WriteFailed(
$"[NODE{nodeFail.NodeIndex}:{nodeFail.NodeRole}][{DateTime.UtcNow.ToShortTimeString()}]: SPEC FAILED: {nodeFail.Message}", "");
Console.ResetColor();

base.HandleNodeSpecFail(nodeFail);
}
Expand Down
83 changes: 75 additions & 8 deletions src/core/Akka.MultiNodeTestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ namespace Akka.MultiNodeTestRunner
/// </summary>
class Program
{
protected static ActorSystem TestRunSystem;
private static HashSet<string> _validNetCorePlatform = new HashSet<string>
{
"net",
"netcore",
"multi"
};

protected static ActorSystem TestRunSystem;
protected static IActorRef SinkCoordinator;

/// <summary>
Expand All @@ -47,6 +53,7 @@ class Program
protected static string OutputDirectory;

protected static bool TeamCityFormattingOn;
protected static bool MultiPlatform;

/// <summary>
/// MultiNodeTestRunner takes the following <see cref="args"/>:
Expand Down Expand Up @@ -128,9 +135,9 @@ static void Main(string[] args)
var platform = CommandLine.GetPropertyOrDefault("multinode.platform", "net");

#if CORECLR
if (platform != "net" && platform != "netcore")
if (!_validNetCorePlatform.Contains(platform))
{
throw new Exception($"Target platform not supported: {platform}. Supported platforms are net and netcore");
throw new Exception($"Target platform not supported: {platform}. Supported platforms are net, netcore and multi");
}
#else
if (platform != "net")
Expand All @@ -146,7 +153,6 @@ static void Main(string[] args)

EnableAllSinks(assemblyPath, platform);
PublishRunnerMessage($"Running MultiNodeTests for {assemblyPath}");

#if CORECLR
// In NetCore, if the assembly file hasn't been touched,
// XunitFrontController would fail loading external assemblies and its dependencies.
Expand All @@ -157,11 +163,19 @@ static void Main(string[] args)
{
try
{
assembly = Assembly.Load(new AssemblyName(asm.FullName));
Assembly.Load(new AssemblyName(asm.FullName));
}
catch (Exception)
{
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.Combine(basePath, asm.Name + ".dll"));
var path = Path.Combine(basePath, asm.Name + ".dll");
try
{
AssemblyLoadContext.Default.LoadFromAssemblyPath(path);
}
catch (Exception e)
{
Console.Out.WriteLine($"Failed to load dll: {path}");
}
}
}
#endif
Expand Down Expand Up @@ -197,6 +211,12 @@ static void Main(string[] args)
PublishRunnerMessage($"Starting test {test.Value.First().MethodName}");

StartNewSpec(test.Value);
#if CORECLR
var ntrBasePath = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..", "..", "..", "..", "Akka.NodeTestRunner", "bin", "Release"));
var ntrNetPath = Path.Combine(AppContext.BaseDirectory, "runner", "net", "Akka.NodeTestRunner.exe");
var ntrNetCorePath = Path.Combine(AppContext.BaseDirectory, "runner", "netcore", "Akka.NodeTestRunner.dll");
var alternateIndex = 0;
#endif
foreach (var nodeTest in test.Value)
{
//Loop through each test, work out number of nodes to run on and kick off process
Expand All @@ -210,18 +230,60 @@ static void Main(string[] args)
.Append($@"-Dmultinode.index={nodeTest.Node - 1} ")
.Append($@"-Dmultinode.role=""{nodeTest.Role}"" ")
.Append($@"-Dmultinode.listen-address={listenAddress} ")
.Append($@"-Dmultinode.listen-port={listenPort}");
.Append($@"-Dmultinode.listen-port={listenPort} ");

#if CORECLR
string fileName = null;
switch (platform)
{
case "net":
fileName = ntrNetPath;
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{assemblyPath}"" ");
break;
case "netcore":
fileName = "dotnet";
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{assemblyPath}"" ");
sbArguments.Insert(0, ntrNetCorePath);
break;
case "multi":
if (alternateIndex % 2 == 0)
{
fileName = ntrNetPath;
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{ChangeDllPathPlatform(assemblyPath, "net452")}"" ");
}
else
{
fileName = "dotnet";
sbArguments.Insert(0, $@" -Dmultinode.test-assembly=""{ChangeDllPathPlatform(assemblyPath, "netcoreapp1.1")}"" ");
sbArguments.Insert(0, ntrNetCorePath);
}
++alternateIndex;
break;
}
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = fileName,
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = sbArguments.ToString(),
WorkingDirectory = Path.GetDirectoryName(assemblyPath)
}
};
#else
sbArguments.Insert(0, $@"-Dmultinode.test-assembly=""{assemblyPath}"" ");
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "Akka.NodeTestRunner.exe",
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = sbArguments.ToString()
}
};
#endif

processes.Add(process);
var nodeIndex = nodeTest.Node;
Expand Down Expand Up @@ -300,7 +362,7 @@ static void Main(string[] args)
}
}
}

CloseAllSinks();

//Block until all Sinks have been terminated.
Expand All @@ -313,6 +375,11 @@ static void Main(string[] args)
Environment.Exit(ExitCodeContainer.ExitCode);
}

static string ChangeDllPathPlatform(string path, string targetPlatform)
{
return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), "..", targetPlatform, Path.GetFileName(path)));
}

static void EnableAllSinks(string assemblyName, string platform)
{
var now = DateTime.UtcNow;
Expand Down
12 changes: 10 additions & 2 deletions src/core/Akka.NodeTestRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ static int Main(string[] args)
{
try
{
assembly = Assembly.Load(new AssemblyName(asm.FullName));
Assembly.Load(new AssemblyName(asm.FullName));
}
catch (Exception)
{
assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(Path.Combine(basePath, asm.Name + ".dll"));
var path = Path.Combine(basePath, asm.Name + ".dll");
try
{
AssemblyLoadContext.Default.LoadFromAssemblyPath(path);
}
catch (Exception e)
{
Console.Out.WriteLine($"Failed to load dll: {path}");
}
}
}
#endif
Expand Down