From 9767811771ce689a93a5951561c470ce9fa9ffb5 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Fri, 18 Dec 2020 11:17:33 +0100 Subject: [PATCH] ensure test TestUserCredentialsPropertiesOnWindows is run only by elevated accounts --- .../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 8a1c854078c2ee..1315ba0a752f06 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -25,7 +25,8 @@ public class ProcessStartInfoTests : ProcessTestBase { 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 @@ public void TestWorkingDirectoryPropertyInChildProcess() }, 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.")]