Skip to content

Commit c648e2a

Browse files
authored
skip flaky tests in official builds (#8497)
* skip flaky tests in official builds * also filter tests on linux
1 parent 19fbfc4 commit c648e2a

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ variables:
2121
value: .NETCore
2222
- name: VisualStudioDropName
2323
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
24+
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
25+
- name: RunningAsPullRequest
26+
value: true
2427

2528
# Variables defined in yml cannot be overridden at queue time; instead overridable variables must be defined in the web UI.
2629
# Commenting out until something like this is supported: https://github.com/Microsoft/azure-pipelines-yaml/pull/129

eng/Build.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,10 @@ function TestUsingNUnit([string] $testProject, [string] $targetFramework) {
256256
$args += " --no-build"
257257
}
258258

259+
if ($env:RunningAsPullRequest -ne "true") {
260+
$args += " --filter TestCategory!=PullRequest"
261+
}
262+
259263
Exec-Console $dotnetExe $args
260264
}
261265

eng/build.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,15 @@ function TestUsingNUnit() {
181181
exit 1
182182
fi
183183

184+
filterArgs=""
185+
if [[ "${RunningAsPullRequest:-}" != "true" ]]; then
186+
filterArgs=" --filter TestCategory!=PullRequest"
187+
fi
188+
184189
projectname=$(basename -- "$testproject")
185190
projectname="${projectname%.*}"
186191
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
187-
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\""
192+
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\"$filterArgs"
188193
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
189194
}
190195

tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type MailboxProcessorType() =
7070
()
7171

7272
[<Test>]
73+
[<Category("PullRequest")>]
7374
member this.``Receive handles cancellation token``() =
7475
let result = ref None
7576

@@ -103,6 +104,7 @@ type MailboxProcessorType() =
103104
Assert.AreEqual(Some("Received 1 Disposed"), !result)
104105

105106
[<Test>]
107+
[<Category("PullRequest")>]
106108
member this.``Receive with timeout argument handles cancellation token``() =
107109
let result = ref None
108110

0 commit comments

Comments
 (0)