From 5ec67701d329af7b563234243d7638545e982be9 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 18 Dec 2020 19:27:42 +0100 Subject: [PATCH] ensure test TestUserCredentialsPropertiesOnWindows is run only by elevated accounts (#46213) --- .../System.Diagnostics.Process/tests/ProcessStartInfoTests.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index 8a1c854..1315ba0 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -25,7 +25,8 @@ namespace System.Diagnostics.Tests { private const string ItemSeparator = "CAFF9451396B4EEF8A5155A15BDC2080"; // random string that shouldn't be in any env vars; used instead of newline to separate env var strings - private static bool IsNotWindowsNanoServerAndRemoteExecutorIsSupported => PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported; + private static bool IsAdmin_IsNotNano_RemoteExecutorIsSupported + => PlatformDetection.IsWindowsAndElevated && PlatformDetection.IsNotWindowsNanoServer && RemoteExecutor.IsSupported; [Fact] public void TestEnvironmentProperty() @@ -450,9 +451,9 @@ namespace System.Diagnostics.Tests }, workingDirectory, new RemoteInvokeOptions { StartInfo = psi }).Dispose(); } - [ConditionalFact(nameof(IsNotWindowsNanoServerAndRemoteExecutorIsSupported))] // Nano has no "netapi32.dll" + [ConditionalFact(nameof(IsAdmin_IsNotNano_RemoteExecutorIsSupported))] // Nano has no "netapi32.dll", Admin rights are required [PlatformSpecific(TestPlatforms.Windows)] - [OuterLoop("Requires admin privileges")] + [OuterLoop("Requires admin privileges")] public void TestUserCredentialsPropertiesOnWindows() { // [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Unit test dummy credentials.")] -- 2.7.4