Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
skip flaky tests in official builds (dotnet#8497)
Browse files Browse the repository at this point in the history
* skip flaky tests in official builds

* also filter tests on linux
  • Loading branch information
brettfo authored and nosami committed Feb 22, 2021
1 parent 329d1f6 commit a17b6ff
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ variables:
value: .NETCore
- name: VisualStudioDropName
value: Products/$(System.TeamProject)/$(Build.Repository.Name)/$(Build.SourceBranchName)/$(Build.BuildNumber)
- ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- name: RunningAsPullRequest
value: true

# Variables defined in yml cannot be overridden at queue time; instead overridable variables must be defined in the web UI.
# Commenting out until something like this is supported: https://github.com/Microsoft/azure-pipelines-yaml/pull/129
Expand Down
4 changes: 4 additions & 0 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ function TestUsingNUnit([string] $testProject, [string] $targetFramework) {
$args += " --no-build"
}

if ($env:RunningAsPullRequest -ne "true") {
$args += " --filter TestCategory!=PullRequest"
}

Exec-Console $dotnetExe $args
}

Expand Down
7 changes: 6 additions & 1 deletion eng/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,15 @@ function TestUsingNUnit() {
exit 1
fi

filterArgs=""
if [[ "${RunningAsPullRequest:-}" != "true" ]]; then
filterArgs=" --filter TestCategory!=PullRequest"
fi

projectname=$(basename -- "$testproject")
projectname="${projectname%.*}"
testlogpath="$artifacts_dir/TestResults/$configuration/${projectname}_$targetframework.xml"
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\""
args="test \"$testproject\" --no-restore --no-build -c $configuration -f $targetframework --test-adapter-path . --logger \"nunit;LogFilePath=$testlogpath\"$filterArgs"
"$DOTNET_INSTALL_DIR/dotnet" $args || exit $?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ type MailboxProcessorType() =
()

[<Test>]
[<Category("PullRequest")>]
member this.``Receive handles cancellation token``() =
let result = ref None

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

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

Expand Down

0 comments on commit a17b6ff

Please sign in to comment.