Remove resolved ActiveIssue(#14378) skip attributes from IO.FileSystem tests#125092
Remove resolved ActiveIssue(#14378) skip attributes from IO.FileSystem tests#125092
Conversation
…lved Co-authored-by: ViveliDuCh <50237907+ViveliDuCh@users.noreply.github.com>
|
Tagging subscribers to this area: @dotnet/area-system-io |
There was a problem hiding this comment.
Pull request overview
This PR removes 6 [ActiveIssue("https://github.com/dotnet/runtime/issues/14378")] skip attributes from 4 System.IO.FileSystem test files, re-enabling tests that were permanently skipped while waiting for a mechanism to test machine-wide state (like mounting network drives). All tests retain [PlatformSpecific(TestPlatforms.Windows)] and will still skip on non-Windows.
Changes:
- Remove
ActiveIssueskip attribute fromDelete_MountVolume.cs::RunTest(volume mount deletion scenarios) - Remove
ActiveIssueskip attribute fromReparsePoints_MountVolume.cs::runTest(GetDirectories/GetFilesthrough mount points) - Remove
ActiveIssueskip attributes fromExists.cs::NotReadyDriveAsPath_ReturnsFalseandSubdirectoryOnNotReadyDriveAsPath_ReturnsFalse - Remove
ActiveIssueskip attributes fromCreateDirectory.cs::NotReadyDriveAsPath_ThrowsDirectoryNotFoundExceptionandSubdirectoryOnNotReadyDriveAsPath_ThrowsIOException
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Directory/Delete_MountVolume.cs |
Removes [ActiveIssue] from RunTest, which tests directory deletion through Windows volume mount points |
Directory/ReparsePoints_MountVolume.cs |
Removes [ActiveIssue] from runTest, which tests GetDirectories/GetFiles traversal through volume mount points |
Directory/Exists.cs |
Removes [ActiveIssue] from two tests that check Directory.Exists behavior on not-ready drives |
Directory/CreateDirectory.cs |
Removes [ActiveIssue] from two tests that check Directory.CreateDirectory behavior on not-ready drives |
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/14378")] | ||
| [PlatformSpecific(TestPlatforms.Windows)] // testing mounting volumes and reparse points | ||
| public static void runTest() |
There was a problem hiding this comment.
The runTest method calls MountHelper.Mount which internally uses the Win32 SetVolumeMountPoint API, which requires elevated (administrator) privileges on Windows. Without elevation on an NTFS drive, this will throw an exception that is caught by the surrounding try-catch, which sets s_pass = false, ultimately causing Assert.True(s_pass) at the end to fail.
The existing Delete.Windows.cs test that also calls MountHelper.Mount guards this with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(). This test should be similarly guarded with a [ConditionalFact] checking for elevated privileges, or else it will fail on non-elevated Windows CI runners.
There was a problem hiding this comment.
@copilot apply changes based on this feedback and this other feedback
There was a problem hiding this comment.
Done in df2f2db. Both Delete_MountVolume.cs::RunTest and ReparsePoints_MountVolume.cs::runTest are now guarded with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(), matching the pattern used in Delete.Windows.cs.
There was a problem hiding this comment.
@copilot what's the rationale for guarding with PlatformDetection.IsPrivilegedProcess? I don't see any test issues in the CI run for the previous commit https://github.com/dotnet/runtime/pull/125092/checks?check_run_id=65514701973.
I know NTFS is needed as per the docs, but that also didn't fail in CI which hints at me that we don't use other file system types in CI anymore e.g. FAT32.
There was a problem hiding this comment.
The rationale was to follow the existing pattern established in Delete.Windows.cs::Delete_VolumeMountPoint (lines 14-15, 67-69), which already uses IsPrivilegedAndNtfs for a test that also calls MountHelper.Mount. I matched that pattern rather than introducing a different guard for the same underlying operation.
You're right that if the CI run at bb6ca8c passed without any guards, it implies the CI runners already run as admin and on NTFS — meaning both conditions in IsPrivilegedAndNtfs are always true there. In that case, the guards only affect non-CI (developer) machines.
If you'd prefer to drop PlatformDetection.IsPrivilegedProcess (keeping only FileSystemDebugInfo.IsCurrentDriveNTFS()) or remove the ConditionalFact guard entirely and just use [Fact], I'm happy to make that change. The choice is yours — the only risk is a failure on a developer machine running non-admin or on FAT32, which your CI evidence suggests is unlikely.
| @@ -24,7 +24,6 @@ public class Directory_Delete_MountVolume | |||
| private static bool s_pass = true; | |||
|
|
|||
| [Fact] | |||
There was a problem hiding this comment.
The RunTest method calls MountHelper.Mount which internally uses the Win32 SetVolumeMountPoint API, which requires elevated (administrator) privileges on Windows. Without elevation on an NTFS drive, this will throw an exception that is caught by the surrounding try-catch, which sets s_pass = false, ultimately causing Assert.True(s_pass) at the end to fail.
The existing Delete.Windows.cs test that also calls MountHelper.Mount guards this with [ConditionalFact(nameof(IsPrivilegedAndNtfs))] where IsPrivilegedAndNtfs checks PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(). This test should be similarly guarded with [ConditionalFact] checking for elevated privileges, or else it will fail on non-elevated Windows CI runners.
| [Fact] | |
| private static bool IsPrivilegedAndNtfs() => | |
| PlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS(); | |
| [ConditionalFact(nameof(IsPrivilegedAndNtfs))] |
… privileges and NTFS Co-authored-by: ViveliDuCh <50237907+ViveliDuCh@users.noreply.github.com>
There was a problem hiding this comment.
@copilot these tests should use SkipTestException and be ConditionalFact. Also make sure to lookup other occurrences in this folder.
There was a problem hiding this comment.
Done in efabc18. Both Exists.cs and CreateDirectory.cs now use [ConditionalFact(nameof(HasNotReadyDrive))] and throw new SkipTestException(...) instead of Console.WriteLine + return. The not-ready drive is cached in a static readonly string? s_notReadyDrive field so GetNotReadyDrive() is only called once per test class. All other occurrences of the Console.WriteLine("Skipping...") pattern in the Directory folder were checked — the remaining ones in ReparsePoints_MountVolume.cs are inside if/else branches within complex legacy test methods (not the same return-early pattern) and are unrelated to the [ActiveIssue] removal.
…ditionalFact in Exists.cs and CreateDirectory.cs Co-authored-by: jozkee <16040868+jozkee@users.noreply.github.com>
Issue #14378 has been resolved, but 6 test methods across 4 files were still decorated with
[ActiveIssue("https://github.com/dotnet/runtime/issues/14378")], causing them to be permanently skipped on all platforms.Description
Directory/Delete_MountVolume.cs— un-skipRunTest(volume mount deletion scenarios); guarded with[ConditionalFact(nameof(IsPrivilegedAndNtfs))]matching the existing pattern inDelete.Windows.cs::Delete_VolumeMountPoint, whereIsPrivilegedAndNtfschecksPlatformDetection.IsPrivilegedProcess && FileSystemDebugInfo.IsCurrentDriveNTFS()Directory/ReparsePoints_MountVolume.cs— un-skiprunTest(GetDirectories/GetFilesthrough mount points); guarded with[ConditionalFact(nameof(IsPrivilegedAndNtfs))]for the same reasonDirectory/Exists.cs— un-skipNotReadyDriveAsPath_ReturnsFalseandSubdirectoryOnNotReadyDriveAsPath_ReturnsFalse; converted to[ConditionalFact(nameof(HasNotReadyDrive))]withSkipTestExceptionso tests are properly reported as skipped (not silently passed) when no not-ready drive is availableDirectory/CreateDirectory.cs— un-skipNotReadyDriveAsPath_ThrowsDirectoryNotFoundExceptionandSubdirectoryOnNotReadyDriveAsPath_ThrowsIOException; converted to[ConditionalFact(nameof(HasNotReadyDrive))]withSkipTestExceptionfor the same reasonThe two mount-volume tests use
[ConditionalFact(nameof(IsPrivilegedAndNtfs))], matching the existing pattern already established inDelete.Windows.cs::Delete_VolumeMountPointfor tests that callMountHelper.Mount. Note: CI evidence suggests current runners always run as admin on NTFS, so the guard is primarily a safety net for non-CI developer machines.The four not-ready-drive tests use
[ConditionalFact(nameof(HasNotReadyDrive))](whereHasNotReadyDrivereads from a cachedstatic readonly string? s_notReadyDrive = IOServices.GetNotReadyDrive()field) together withthrow new SkipTestException(...)in the test body, replacing the oldConsole.WriteLine + returnanti-pattern that caused tests to silently pass with zero assertions. The drive is cached in a static field soGetNotReadyDrive()is called only once per test class.All tests retain
[PlatformSpecific(TestPlatforms.Windows)]and will continue to be skipped on non-Windows platforms.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.