Skip to content

Commit 9cfde9c

Browse files
authored
Give AzureDevops its own .runsettings so that it picks up the tests a… (#4361)
* Give AzureDevops its own .runsettings so that it picks up the tests again * Always publish unit test results
1 parent c0d6e62 commit 9cfde9c

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

Elasticsearch.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{6C4A2627
1515
ProjectSection(SolutionItems) = preProject
1616
tests\Directory.Build.props = tests\Directory.Build.props
1717
tests\.runsettings = tests\.runsettings
18+
tests\.ci.runsettings = tests\.ci.runsettings
1819
EndProjectSection
1920
EndProject
2021
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "tests\Tests\Tests.csproj", "{5B393962-7586-49BA-BD99-3B1E35F48E94}"

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- script: ./build.sh test-one
2222
displayName: 'build and unit test'
2323
- task: PublishTestResults@2
24+
condition: succeededOrFailed()
2425
inputs:
2526
testRunner: VSTest
2627
testResultsFiles: 'tests/**/*.trx'
@@ -52,6 +53,7 @@ jobs:
5253
- script: build.bat canary
5354
displayName: 'build and unit test'
5455
- task: PublishTestResults@2
56+
condition: succeededOrFailed()
5557
inputs:
5658
testRunner: VSTest
5759
testResultsFiles: 'tests/**/*.trx'

build/scripts/Commandline.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ Execution hints can be provided anywhere on the command line
111111

112112
let private buildingOnAzurePipeline = Environment.environVarAsBool "TF_BUILD"
113113

114-
let runningOnCi = Environment.hasEnvironVar "TF_BUILD" || Environment.hasEnvironVar "APPVEYOR_BUILD_VERSION"
114+
let runningOnAzureDevops = Environment.hasEnvironVar "TF_BUILD"
115+
let runningOnCi = runningOnAzureDevops || Environment.hasEnvironVar "APPVEYOR_BUILD_VERSION"
115116

116117
let parse (args: string list) =
117118

build/scripts/Testing.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ module Tests =
3434
ignore()
3535

3636
let private dotnetTest proj args =
37+
let runSettings =
38+
// force the logger section to be cleared so that azure devops can work its magic.
39+
// relies heavily on the original console logger
40+
let prefix = if Commandline.runningOnAzureDevops then ".ci" else ""
41+
sprintf "tests/%s.runsettings" prefix
42+
3743
Directory.CreateDirectory Paths.BuildOutput |> ignore
38-
let command = ["test"; proj; "--nologo"; "-c"; "Release"; "-s"; "tests/.runsettings"; "--no-build"]
44+
let command = ["test"; proj; "--nologo"; "-c"; "Release"; "-s"; runSettings; "--no-build"]
3945

4046
let wantsTrx =
4147
let wants = match args.CommandArguments with | Integration a -> a.TrxExport | Test t -> t.TrxExport | _ -> false

tests/.ci.runsettings

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<RunSettings>
2+
<RunConfiguration>
3+
<CollectSourceInformation>true</CollectSourceInformation>
4+
</RunConfiguration>
5+
<DataCollectionRunSettings>
6+
<DataCollectors>
7+
<DataCollector friendlyName="XPlat Code Coverage">
8+
<Configuration>
9+
<Format>cobertura</Format>
10+
<UseSourceLink>true</UseSourceLink>
11+
</Configuration>
12+
</DataCollector>
13+
</DataCollectors>
14+
</DataCollectionRunSettings>
15+
</RunSettings>

0 commit comments

Comments
 (0)