From a996450e6047a195cdf53e47958e875c3ad15a22 Mon Sep 17 00:00:00 2001 From: "Brett V. Forsgren" Date: Thu, 6 Feb 2020 13:01:01 -0800 Subject: [PATCH] skip flaky tests in official builds --- azure-pipelines.yml | 3 +++ .../Microsoft.FSharp.Control/MailboxProcessorType.fs | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 966baf9ee2b1..fc3e1ca096a8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs index 5dfafab87706..cb4b838aa9c0 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/MailboxProcessorType.fs @@ -19,6 +19,10 @@ type Message = [] type MailboxProcessorType() = + let onlyRunTestOnPullRequest() = + if String.Compare(Environment.GetEnvironmentVariable("RunningAsPullRequest"), "true", StringComparison.OrdinalIgnoreCase) = 0 then () + else Assert.Ignore("Test is skipped in non-PR environments") + let getSimpleMailbox() = let mailbox = new MailboxProcessor(fun inbox -> @@ -71,6 +75,7 @@ type MailboxProcessorType() = [] member this.``Receive handles cancellation token``() = + onlyRunTestOnPullRequest() let result = ref None // https://github.com/Microsoft/visualfsharp/issues/3337 @@ -104,6 +109,7 @@ type MailboxProcessorType() = [] member this.``Receive with timeout argument handles cancellation token``() = + onlyRunTestOnPullRequest() let result = ref None // https://github.com/Microsoft/visualfsharp/issues/3337