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

[MNTR] Migrate to standalone MNTR #5307

Merged
merged 10 commits into from
Oct 20, 2021
20 changes: 4 additions & 16 deletions build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,22 +140,10 @@ jobs:

- template: azure-pipeline.mntr-template.yaml
parameters:
name: "net_fx_mntr_windows"
displayName: ".NET Framework Multi-Node Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: "build.cmd"
scriptArgs: MultiNodeTests incremental
outputDirectory: "TestResults"
artifactName: "net_fx_mntr_windows-$(Build.BuildId)"
mntrFailuresDir: 'TestResults\\multinode'
mntrFailuresArtifactName: "net_fx_mntr_FAILED_windows-$(Build.BuildId)"

- template: azure-pipeline.mntr-template.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do we need this mtnr-template.yaml anymore?

parameters:
name: "net_5_mntr_windows"
displayName: ".NET 5 Multi-Node Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: "build.cmd"
name: 'net_5_mntr_windows'
displayName: '.NET 5 Multi-Node Tests (Windows)'
vmImage: 'windows-2019'
scriptFileName: 'build.cmd'
scriptArgs: MultiNodeTestsNet incremental
outputDirectory: "TestResults"
artifactName: "net_5_mntr_windows-$(Build.BuildId)"
Expand Down
143 changes: 48 additions & 95 deletions build.fsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
open System.Runtime.ExceptionServices

#I @"tools/FAKE/tools"
#r "FakeLib.dll"

Expand Down Expand Up @@ -238,7 +240,9 @@ Target "RunTests" (fun _ ->
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.*sproj"
++ "./src/**/Akka.Streams.Tests.TCK.csproj"
-- "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
-- "./src/**/*.Tests.MultiNode.csproj"
rawProjects |> Seq.choose filterProjects

let runSingleProject project =
Expand All @@ -264,7 +268,9 @@ Target "RunTestsNetCore" (fun _ ->
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.*sproj"
++ "./src/**/Akka.Streams.Tests.TCK.csproj"
-- "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
-- "./src/**/*.Tests.MultiNode.csproj"
rawProjects |> Seq.choose filterProjects

let runSingleProject project =
Expand All @@ -290,7 +296,9 @@ Target "RunTestsNet" (fun _ ->
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.*sproj"
++ "./src/**/Akka.Streams.Tests.TCK.csproj"
-- "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
-- "./src/**/*.Tests.MultiNode.csproj"
rawProjects |> Seq.choose filterProjects

let runSingleProject project =
Expand All @@ -310,123 +318,70 @@ Target "RunTestsNet" (fun _ ->
projects |> Seq.iter (runSingleProject)
)

Target "MultiNodeTests" (fun _ ->
Target "MultiNodeTestsNetCore" (fun _ ->
if not skipBuild.Value then
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.exe" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ testNetFrameworkVersion)
setEnvironVar "AKKA_CLUSTER_ASSERT" "on" // needed to enable assert invariants for Akka.Cluster

let projects =
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.MulitNode.csproj" // if you need to filter specs for Linux vs. Windows, do it here
rawProjects |> Seq.choose filterProjects

let multiNodeTestAssemblies =
projects |> Seq.choose (getTestAssembly Runtime.NetFramework)

printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath

let runMultiNodeSpec assembly =
let spec = getBuildParam "spec"

let args = StringBuilder()
|> append assembly
|> append (sprintf "-Dmultinode.reporter=%s" (if hasTeamCity then "teamcity" else "trx"))
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append (sprintf "-Dmultinode.failed-specs-directory=\"%s\"" outputFailedMultiNode)
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText
let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetCoreVersion outputMultiNode)
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetCoreVersion outputMultiNode)

let result = ExecProcess(fun info ->
info.FileName <- multiNodeTestPath
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args
info.FileName <- "dotnet"
info.WorkingDirectory <- (Directory.GetParent project).FullName
info.Arguments <- arguments) (TimeSpan.FromMinutes 90.0)

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result

multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
CreateDir outputMultiNode
projects |> Seq.iter ( fun project ->
try
runSingleProject project
with
ex ->
raise (Exception(sprintf "Exception thrown while testing %s" project, ex))
)
)

Target "MultiNodeTestsNetCore" (fun _ ->
Target "MultiNodeTestsNet" (fun _ ->
if not skipBuild.Value then
setEnvironVar "AKKA_CLUSTER_ASSERT" "on" // needed to enable assert invariants for Akka.Cluster
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ testNetCoreVersion @@ "win10-x64" @@ "publish")

let projects =
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.MulitNode.csproj" // if you need to filter specs for Linux vs. Windows, do it here
rawProjects |> Seq.choose filterProjects

let multiNodeTestAssemblies =
projects |> Seq.choose (getTestAssembly Runtime.NetCore)

printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath

let runMultiNodeSpec assembly =
match assembly with
| null -> ()
| _ ->
let spec = getBuildParam "spec"

let args = StringBuilder()
|> append multiNodeTestPath
|> append assembly
|> append "-Dmultinode.reporter=trx"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append (sprintf "-Dmultinode.failed-specs-directory=\"%s\"" outputFailedMultiNode)
|> append "-Dmultinode.platform=netcore"
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args

multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
)
Target "MultiNodeTestsNet" (fun _ ->
if not skipBuild.Value then
setEnvironVar "AKKA_CLUSTER_ASSERT" "on" // needed to enable assert invariants for Akka.Cluster
let multiNodeTestPath = findToolInSubPath "Akka.MultiNodeTestRunner.dll" (currentDirectory @@ "src" @@ "core" @@ "Akka.MultiNodeTestRunner" @@ "bin" @@ "Release" @@ testNetVersion @@ "win10-x64" @@ "publish")
let runSingleProject project =
let arguments =
match (hasTeamCity) with
| true -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none -teamcity" testNetVersion outputMultiNode)
| false -> (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetVersion outputMultiNode)

let projects =
let rawProjects = match (isWindows) with
| true -> !! "./src/**/*.Tests.MultiNode.csproj"
| _ -> !! "./src/**/*.Tests.MulitNode.csproj" // if you need to filter specs for Linux vs. Windows, do it here
rawProjects |> Seq.choose filterProjects
let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Directory.GetParent project).FullName
info.Arguments <- arguments) (TimeSpan.FromMinutes 90.0)

ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result

let multiNodeTestAssemblies =
projects |> Seq.choose (getTestAssembly Runtime.Net)

printfn "Using MultiNodeTestRunner: %s" multiNodeTestPath

let runMultiNodeSpec assembly =
match assembly with
| null -> ()
| _ ->
let spec = getBuildParam "spec"

let args = StringBuilder()
|> append multiNodeTestPath
|> append assembly
|> append "-Dmultinode.reporter=trx"
|> append "-Dmultinode.enable-filesink=on"
|> append (sprintf "-Dmultinode.output-directory=\"%s\"" outputMultiNode)
|> append (sprintf "-Dmultinode.failed-specs-directory=\"%s\"" outputFailedMultiNode)
|> append "-Dmultinode.platform=net5"
|> appendIfNotNullOrEmpty spec "-Dmultinode.spec="
|> toText

let result = ExecProcess(fun info ->
info.FileName <- "dotnet"
info.WorkingDirectory <- (Path.GetDirectoryName (FullName multiNodeTestPath))
info.Arguments <- args) (System.TimeSpan.FromMinutes 60.0) (* This is a VERY long running task. *)
if result <> 0 then failwithf "MultiNodeTestRunner failed. %s %s" multiNodeTestPath args

multiNodeTestAssemblies |> Seq.iter (runMultiNodeSpec)
CreateDir outputMultiNode
projects |> Seq.iter ( fun project ->
try
runSingleProject project
with
ex ->
raise (Exception(sprintf "Exception thrown while testing %s" project, ex))
)
)
Target "NBench" (fun _ ->
ensureDirectory outputPerfTests
Expand Down Expand Up @@ -746,7 +701,6 @@ Target "RunTestsNetCoreFull" DoNothing

"BuildRelease" ==> "MultiNodeTestsNetCore"
"BuildRelease" ==> "MultiNodeTestsNet"
"BuildRelease" ==> "MultiNodeTests"

// nuget dependencies
"BuildRelease" ==> "CreateMntrNuget" ==> "CreateNuget" ==> "PublishNuget" ==> "Nuget"
Expand All @@ -759,7 +713,6 @@ Target "RunTestsNetCoreFull" DoNothing
"RunTests" ==> "All"
"RunTestsNetCore" ==> "All"
"RunTestsNet" ==> "All"
"MultiNodeTests" ==> "All"
"MultiNodeTestsNetCore" ==> "All"
"MultiNodeTestsNet" ==> "All"
"NBench" ==> "All"
Expand Down
1 change: 0 additions & 1 deletion src/NuGet.Config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<add key="disableSourceControlIntegration" value="true" />
</solution>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
1 change: 1 addition & 0 deletions src/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<FsCheckVersion>2.16.3</FsCheckVersion>
<HoconVersion>2.0.3</HoconVersion>
<ConfigurationManagerVersion>4.7.0</ConfigurationManagerVersion>
<MultiNodeAdapterVersion>1.0.0-beta2</MultiNodeAdapterVersion>
<AkkaPackageTags>akka;actors;actor model;Akka;concurrency</AkkaPackageTags>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<AssemblyTitle>Akka.Cluster.Metrics.Tests.MultiNode</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
<TargetFrameworks>$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -13,9 +13,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Akka.MultiNode.TestAdapter" Version="$(MultiNodeAdapterVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<AssemblyTitle>Akka.Cluster.Sharding.Tests.MultiNode</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, we're dropping .NET Framework MNTR specs for this right?

<TargetFrameworks>$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,9 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Akka.MultiNode.TestAdapter" Version="$(MultiNodeAdapterVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<AssemblyTitle>Akka.Cluster.Tools.Tests.MultiNode</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
<TargetFrameworks>$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,9 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Akka.MultiNode.TestAdapter" Version="$(MultiNodeAdapterVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<AssemblyTitle>Akka.DistributedData.Tests.MultiNode</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
<TargetFrameworks>$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,9 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Akka.MultiNode.TestAdapter" Version="$(MultiNodeAdapterVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<PropertyGroup>
<AssemblyTitle>Akka.Cluster.Tests.MultiNode</AssemblyTitle>
<TargetFrameworks>$(NetFrameworkTestVersion);$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
<TargetFrameworks>$(NetTestVersion);$(NetCoreTestVersion)</TargetFrameworks>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand All @@ -14,9 +14,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Akka.MultiNode.TestAdapter" Version="$(MultiNodeAdapterVersion)" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(TestSdkVersion)" />
<PackageReference Include="xunit" Version="$(XunitVersion)" />
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitVersion)" />
<PackageReference Include="FluentAssertions" Version="$(FluentAssertionsVersion)" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,17 @@ public void Cluster_seed_nodes__must_be_able_to_restart_first_seed_node_and_join
{
var seeds = GetSeedNodes();
seeds.Count.Should().Be(4); // validate that we have complete seed node list
Cluster.Get(seed1System.Value).JoinSeedNodes(seeds);
var cluster = Cluster.Get(seed1System.Value);
cluster.JoinSeedNodes(seeds);
AwaitAssert(() =>
{
Cluster.Get(seed1System.Value)
.State.Members.Count
.Should()
.Be(3);
}, TimeSpan.FromSeconds(10));
cluster.State.Members.Count.Should().Be(3);
}, TimeSpan.FromSeconds(20));
AwaitAssert(() =>
{
Cluster.Get(seed1System.Value)
cluster
.State.Members.All(c => c.Status == MemberStatus.Up)
.Should()
.BeTrue();
.Should().BeTrue();
});
}, _config.Seed1);
RunOn(() =>
Expand Down
Loading