Disable 2 FSW tests failing only on macOS 12 (#70365)
authorDan Moseley <danmose@microsoft.com>
Wed, 8 Jun 2022 05:26:44 +0000 (23:26 -0600)
committerGitHub <noreply@github.com>
Wed, 8 Jun 2022 05:26:44 +0000 (00:26 -0500)
* Disable 2 osx fsw tests

* Use ConditionalTheory

Co-authored-by: Jozkee <dacantu@microsoft.com>
src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.Directory.Move.cs
src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs

index 21e2cef..15b4b27 100644 (file)
@@ -1,11 +1,11 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Xunit;
-
+using Microsoft.DotNet.XUnitExtensions;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
+using Xunit;
 
 namespace System.IO.Tests
 {
@@ -25,13 +25,18 @@ namespace System.IO.Tests
             DirectoryMove_FromWatchedToUnwatched(WatcherChangeTypes.Deleted);
         }
 
-        [Theory]
+        [ConditionalTheory]
         [PlatformSpecific(TestPlatforms.OSX)]
         [InlineData(1)]
         [InlineData(2)]
         [InlineData(3)]
         public void Directory_Move_Multiple_From_Watched_To_Unwatched_Mac(int filesCount)
         {
+            if (Environment.OSVersion.Version.Major == 12)
+            {
+                throw new SkipTestException("Unreliable on Monterey"); // https://github.com/dotnet/runtime/issues/70164
+            }
+
             // On Mac, the FSStream aggregate old events caused by the test setup.
             // There is no option how to get rid of it but skip it.
             DirectoryMove_Multiple_FromWatchedToUnwatched(filesCount, skipOldEvents: true);
index fda15c4..999ac6b 100644 (file)
@@ -1,6 +1,7 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
+using Microsoft.DotNet.XUnitExtensions;
 using System.Collections.Generic;
 using System.Linq;
 using Xunit;
@@ -29,13 +30,18 @@ namespace System.IO.Tests
             FileMove_FromWatchedToUnwatched(WatcherChangeTypes.Deleted);
         }
 
-        [Theory]
+        [ConditionalTheory]
         [PlatformSpecific(TestPlatforms.OSX)]
         [InlineData(1)]
         [InlineData(2)]
         [InlineData(3)]
         public void File_Move_Multiple_From_Watched_To_Unwatched_Mac(int filesCount)
         {
+            if (Environment.OSVersion.Version.Major == 12)
+            {
+                throw new SkipTestException("Unreliable on Monterey"); // https://github.com/dotnet/runtime/issues/70164
+            }
+
             // On Mac, the FSStream aggregate old events caused by the test setup.
             // There is no option how to get rid of it but skip it.
             FileMove_Multiple_FromWatchedToUnwatched(filesCount, skipOldEvents: true);