Skip to content

Commit 822c40d

Browse files
committed
moved to dotnet-xunit instead of self hosted runner, teamcity appveyor reporters and out files should be back now
Conflicts: src/Tests/Tests.csproj Conflicts: build/Clients.Common.targets src/Tests/Tests.csproj
1 parent ed1fef6 commit 822c40d

File tree

6 files changed

+41
-159
lines changed

6 files changed

+41
-159
lines changed

build/Clients.Common.targets

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,26 @@
1414
<!-- File version reflects actual version number without prelease since that not allowed in its struct -->
1515
<FileVersion>$(CurrentAssemblyFileVersion)</FileVersion>
1616

17-
<!-- 'dotnet xunit' does a build but has no way to pass properties or prevent build so we snoop for TRAVIS here
18-
Ideally we handle this in the FAKE script (which we do for 'dotnet build')
19-
TODO too lazy to write and test a <CHOOSE>
20-
-->
21-
<DotNetCoreOnly Condition="'$(TRAVIS)'=='true'">1</DotNetCoreOnly>
22-
<DotNetCoreOnly Condition="'$(TRAVIS)'==''"></DotNetCoreOnly>
17+
<Authors></Authors>
18+
<Company></Company>
19+
<NeutralLanguage></NeutralLanguage>
20+
<AssemblyTitle></AssemblyTitle>
21+
<Description></Description>
22+
<Copyright></Copyright>
23+
<DotNetCoreOnly></DotNetCoreOnly>
2324
<DoSourceLink></DoSourceLink>
25+
26+
27+
28+
29+
2430
<SignAssembly>true</SignAssembly>
2531
<AssemblyOriginatorKeyFile Condition="'$(DotNetCoreOnly)'==''">..\..\build\keys\keypair.snk</AssemblyOriginatorKeyFile>
2632
<GenerateDocumentationFile Condition="'$(DotNetCoreOnly)'==''">true</GenerateDocumentationFile>
2733
<NoWarn>1591,1572,1571,1573,1587,1570</NoWarn>
2834
<Prefer32Bit>false</Prefer32Bit>
2935
<DefineConstants Condition="'$(TargetFramework)'=='netstandard1.3' OR '$(DotNetCoreOnly)'=='1'">$(DefineConstants);DOTNETCORE</DefineConstants>
30-
<DebugType>embedded</DebugType>
36+
<DebugType Condition="'$(DotNetCoreOnly)'==''">embedded</DebugType>
3137
<SourceLink Condition="'$(DoSourceLink)'!=''">$(BaseIntermediateOutputPath)\sl-$(MsBuildProjectName)-$(TargetFramework).json</SourceLink>
3238
<RepoUri>https://raw.githubusercontent.com/elastic/elasticsearch-net</RepoUri>
3339
</PropertyGroup>

build/scripts/Testing.fsx

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,26 @@ module Tests =
2323
setProcessEnvironVar "NEST_INTEGRATION_CLUSTER" clusterFilter
2424
setProcessEnvironVar "NEST_TEST_FILTER" testFilter
2525

26-
let private dotnetTest() =
27-
let folder = Paths.IncrementalOutputFolder (PrivateProject PrivateProject.Tests) DotNetFramework.NetCoreApp1_1
28-
let testPath = sprintf "%s/Tests.dll" folder
29-
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(10.) }) (sprintf "%s -- Test" testPath) |> ignore
30-
31-
let private runTestExeOnDesktopCLR() =
32-
let folder = Paths.IncrementalOutputFolder (PrivateProject PrivateProject.Tests) DotNetFramework.Net46
33-
let testRunner = Tooling.BuildTooling(folder @@ "Tests.exe")
34-
testRunner.Exec ["Test"; "-parallel"; "-xml"; Paths.Output("TestResults-Desktop-Clr.xml")] |> ignore
35-
26+
type MultiTarget = All | One
27+
let private dotnetTest target =
28+
CreateDir Paths.BuildOutput
29+
let command =
30+
let p = ["xunit"; "-parallel"; "all"; "-xml"; "../.." @@ Paths.Output("TestResults-Desktop-Clr.xml")]
31+
match (target, buildingOnTravis) with
32+
| (_, true)
33+
| (One, _) -> p |> List.append ["-framework"; "netcoreapp1.1"]
34+
| _ -> p
35+
36+
let dotnet = Tooling.BuildTooling("dotnet")
37+
dotnet.ExecIn "src/Tests" command |> ignore
38+
3639
let IncrementalTest() =
3740
setLocalEnvVars()
38-
match buildingOnTravis with
39-
| false -> runTestExeOnDesktopCLR()
40-
| true -> dotnetTest()
41+
dotnetTest One
4142

4243
let RunUnitTests() =
4344
setLocalEnvVars()
44-
dotnetTest()
45-
runTestExeOnDesktopCLR()
45+
dotnetTest All
4646

4747
let RunIntegrationTests() =
4848
setLocalEnvVars()
@@ -54,6 +54,4 @@ module Tests =
5454

5555
for esVersion in esVersions do
5656
setProcessEnvironVar "NEST_INTEGRATION_VERSION" esVersion
57-
runTestExeOnDesktopCLR()
58-
//TODO enable integration testing on .net CORE
59-
//dotnetTest()
57+
dotnetTest One |> ignore

build/scripts/Tooling.fsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ module Tooling =
4949
()
5050

5151

52-
let execProcessWithTimeout proc arguments timeout =
52+
let execProcessWithTimeout proc arguments timeout workingDir =
5353
let args = arguments |> String.concat " "
5454
ExecProcess (fun info ->
5555
info.FileName <- proc
56-
info.WorkingDirectory <- "."
56+
info.WorkingDirectory <- workingDir
5757
info.Arguments <- args
5858
) timeout
5959

@@ -69,12 +69,14 @@ module Tooling =
6969

7070
let private defaultTimeout = TimeSpan.FromMinutes 15.0
7171

72-
let execProcess proc arguments =
73-
let exitCode = execProcessWithTimeout proc arguments defaultTimeout
72+
let execProcessInDirectory proc arguments workingDir =
73+
let exitCode = execProcessWithTimeout proc arguments defaultTimeout workingDir
7474
match exitCode with
7575
| 0 -> exitCode
7676
| _ -> failwithf "Calling %s resulted in unexpected exitCode %i" proc exitCode
7777

78+
let execProcess proc arguments = execProcessInDirectory proc arguments "."
79+
7880

7981
let execProcessAndReturnMessages proc arguments =
8082
execProcessWithTimeoutAndReturnMessages proc arguments defaultTimeout
@@ -94,6 +96,7 @@ module Tooling =
9496
type BuildTooling(path) =
9597
member this.Path = path
9698
member this.Exec arguments = execProcess this.Path arguments
99+
member this.ExecIn workingDirectory arguments = execProcessInDirectory this.Path arguments workingDirectory
97100

98101
type DotTraceTool = {
99102
Name:string;
@@ -152,7 +155,7 @@ module Tooling =
152155
this.ExecWithTimeout arguments (TimeSpan.FromMinutes 30.)
153156

154157
member this.ExecWithTimeout arguments timeout =
155-
let result = execProcessWithTimeout exe arguments timeout
158+
let result = execProcessWithTimeout exe arguments timeout "."
156159
if result <> 0 then failwith (sprintf "Failed to run dotnet tooling for %s args: %A" exe arguments)
157160

158161
let DotNet = new DotNetTooling("dotnet.exe")

src/Tests/Framework/Xunit/TestRunner.cs

Lines changed: 0 additions & 123 deletions
This file was deleted.

src/Tests/Program.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ public static void Main(string[] args)
9090
var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
9191
benchmarkSwitcher.Run(arguments);
9292
}
93-
else
94-
{
95-
TestRunner.Run(arguments);
96-
}
9793
}
9894

9995
#if !DOTNETCORE

src/Tests/Tests.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
<VersionSuffix>alpha</VersionSuffix>
1010
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp1.1' OR '$(DotNetCoreOnly)'=='1'">$(DefineConstants);DOTNETCORE</DefineConstants>
1111
</PropertyGroup>
12+
<ItemGroup>
13+
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
14+
</ItemGroup>
1215
<ItemGroup>
1316
<ProjectReference Include="..\Nest\Nest.csproj" />
1417
<PackageReference Include="Bogus" Version="11.0.5" />
1518
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
1619
<PackageReference Include="FluentAssertions" Version="4.19.2" />
17-
<PackageReference Include="xunit" Version="2.2.0" />
18-
<PackageReference Include="xunit.runner.utility" Version="2.2.0" />
20+
<PackageReference Include="xunit" Version="2.3.0-beta1-build3642" />
1921
<PackageReference Include="SemanticVersioning" Version="0.7.6" />
2022
<PackageReference Include="BenchMarkDotNet" Version="0.10.0" />
2123
<PackageReference Include="DiffPlex" Version="1.4.1" />

0 commit comments

Comments
 (0)