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

moved to dotnet-xunit instead of self hosted runner, teamcity appveyo… #2722

Merged
merged 4 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 8 additions & 7 deletions build/Clients.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@
<!-- File version reflects actual version number without prelease since that not allowed in its struct -->
<FileVersion>$(CurrentAssemblyFileVersion)</FileVersion>

<Authors></Authors>
<Company></Company>
<NeutralLanguage></NeutralLanguage>
<AssemblyTitle></AssemblyTitle>
<Description></Description>
<Copyright></Copyright>
<!-- 'dotnet xunit' does a build but has no way to pass properties or prevent build so we snoop for TRAVIS here
Ideally we handle this in the FAKE script (which we do for 'dotnet build')
TODO too lazy to write and test a <CHOOSE>
-->
<DotNetCoreOnly Condition="'$(TRAVIS)'=='true'">1</DotNetCoreOnly>
<DotNetCoreOnly Condition="'$(TRAVIS)'==''"></DotNetCoreOnly>
<DoSourceLink></DoSourceLink>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile Condition="'$(DotNetCoreOnly)'==''">..\..\build\keys\keypair.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile Condition="'$(DotNetCoreOnly)'==''">true</GenerateDocumentationFile>
<NoWarn>1591,1572,1571,1573,1587,1570</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
<DefineConstants Condition="'$(TargetFramework)'=='netstandard1.3' OR '$(DotNetCoreOnly)'=='1'">$(DefineConstants);DOTNETCORE</DefineConstants>
<DebugType Condition="'$(DotNetCoreOnly)'==''">embedded</DebugType>
<DebugType>embedded</DebugType>
<SourceLink Condition="'$(DoSourceLink)'!=''">$(BaseIntermediateOutputPath)\sl-$(MsBuildProjectName)-$(TargetFramework).json</SourceLink>
<RepoUri>https://raw.githubusercontent.com/elastic/elasticsearch-net</RepoUri>
</PropertyGroup>
Expand Down
34 changes: 16 additions & 18 deletions build/scripts/Testing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ module Tests =
setProcessEnvironVar "NEST_INTEGRATION_CLUSTER" clusterFilter
setProcessEnvironVar "NEST_TEST_FILTER" testFilter

let private dotnetTest() =
let folder = Paths.IncrementalOutputFolder (PrivateProject PrivateProject.Tests) DotNetFramework.NetCoreApp1_1
let testPath = sprintf "%s/Tests.dll" folder
DotNetCli.RunCommand (fun p -> { p with TimeOut = TimeSpan.FromMinutes(10.) }) (sprintf "%s -- Test" testPath) |> ignore

let private runTestExeOnDesktopCLR() =
let folder = Paths.IncrementalOutputFolder (PrivateProject PrivateProject.Tests) DotNetFramework.Net46
let testRunner = Tooling.BuildTooling(folder @@ "Tests.exe")
testRunner.Exec ["Test"; "-parallel"; "-xml"; Paths.Output("TestResults-Desktop-Clr.xml")] |> ignore

type MultiTarget = All | One
let private dotnetTest target =
CreateDir Paths.BuildOutput
let command =
let p = ["xunit"; "-parallel"; "all"; "-xml"; "../.." @@ Paths.Output("TestResults-Desktop-Clr.xml")]
match (target, buildingOnTravis) with
| (_, true)
| (One, _) -> ["-framework"; "netcoreapp1.1"] |> List.append p
| _ -> p

let dotnet = Tooling.BuildTooling("dotnet")
dotnet.ExecIn "src/Tests" command |> ignore

let IncrementalTest() =
setLocalEnvVars()
match buildingOnTravis with
| false -> runTestExeOnDesktopCLR()
| true -> dotnetTest()
dotnetTest One

let RunUnitTests() =
setLocalEnvVars()
dotnetTest()
runTestExeOnDesktopCLR()
dotnetTest All

let RunIntegrationTests() =
setLocalEnvVars()
Expand All @@ -54,6 +54,4 @@ module Tests =

for esVersion in esVersions do
setProcessEnvironVar "NEST_INTEGRATION_VERSION" esVersion
runTestExeOnDesktopCLR()
//TODO enable integration testing on .net CORE
//dotnetTest()
dotnetTest One |> ignore
13 changes: 8 additions & 5 deletions build/scripts/Tooling.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ module Tooling =
()


let execProcessWithTimeout proc arguments timeout =
let execProcessWithTimeout proc arguments timeout workingDir =
let args = arguments |> String.concat " "
ExecProcess (fun info ->
info.FileName <- proc
info.WorkingDirectory <- "."
info.WorkingDirectory <- workingDir
info.Arguments <- args
) timeout

Expand All @@ -69,12 +69,14 @@ module Tooling =

let private defaultTimeout = TimeSpan.FromMinutes 15.0

let execProcess proc arguments =
let exitCode = execProcessWithTimeout proc arguments defaultTimeout
let execProcessInDirectory proc arguments workingDir =
let exitCode = execProcessWithTimeout proc arguments defaultTimeout workingDir
match exitCode with
| 0 -> exitCode
| _ -> failwithf "Calling %s resulted in unexpected exitCode %i" proc exitCode

let execProcess proc arguments = execProcessInDirectory proc arguments "."


let execProcessAndReturnMessages proc arguments =
execProcessWithTimeoutAndReturnMessages proc arguments defaultTimeout
Expand All @@ -94,6 +96,7 @@ module Tooling =
type BuildTooling(path) =
member this.Path = path
member this.Exec arguments = execProcess this.Path arguments
member this.ExecIn workingDirectory arguments = execProcessInDirectory this.Path arguments workingDirectory

type DotTraceTool = {
Name:string;
Expand Down Expand Up @@ -152,7 +155,7 @@ module Tooling =
this.ExecWithTimeout arguments (TimeSpan.FromMinutes 30.)

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

let DotNet = new DotNetTooling("dotnet.exe")
Expand Down
123 changes: 0 additions & 123 deletions src/Tests/Framework/Xunit/TestRunner.cs

This file was deleted.

4 changes: 0 additions & 4 deletions src/Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ public static void Main(string[] args)
var benchmarkSwitcher = new BenchmarkSwitcher(GetBenchmarkTypes());
benchmarkSwitcher.Run(arguments);
}
else
{
TestRunner.Run(arguments);
}
}

#if !DOTNETCORE
Expand Down
14 changes: 9 additions & 5 deletions src/Tests/Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<DotNetCoreOnly Condition="'$(TRAVIS)'=='true'">1</DotNetCoreOnly>
<DotNetCoreOnly Condition="'$(TRAVIS)'==''"></DotNetCoreOnly>
<OutputType>Exe</OutputType>
<TargetFrameworks Condition="'$(DotNetCoreOnly)'==''">netcoreapp1.1;net45;net46</TargetFrameworks>
<TargetFramework Condition="'$(DotNetCoreOnly)'=='1'">netcoreapp1.1</TargetFramework>
<TargetFramework Condition="'$(DotNetCoreOnly)'=='1'">netcoreapp1.1</TargetFramework>
<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix>alpha</VersionSuffix>
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp1.1'">$(DefineConstants);DOTNETCORE</DefineConstants>
<DefineConstants Condition="'$(TargetFramework)'=='netcoreapp1.1' OR '$(DotNetCoreOnly)'=='1'">$(DefineConstants);DOTNETCORE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Nest\Nest.csproj" />
<PackageReference Include="Bogus" Version="11.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="FluentAssertions" Version="4.19.2" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.utility" Version="2.2.0" />
<PackageReference Include="xunit" Version="2.3.0-beta1-build3642" />
<PackageReference Include="SemanticVersioning" Version="0.7.6" />
<PackageReference Include="BenchMarkDotNet" Version="0.10.0" />
<PackageReference Include="DiffPlex" Version="1.4.1" />
Expand All @@ -34,4 +38,4 @@
<ItemGroup>
<EmbeddedResource Include="Document\Single\Attachment\Attachment_Test_Document.pdf" />
</ItemGroup>
</Project>
</Project>