From 99bffa97b96c99d4744b4a13b5bc1cbd3eb8896a Mon Sep 17 00:00:00 2001 From: Dan Moseley Date: Mon, 18 Sep 2017 07:54:57 -0700 Subject: [PATCH] Disable NegotiateStreamTest fixture for distros without working Kerberos (#24098) Disable NegotiateStreamTest fixture entirely because setup-kdc.sh is broken on some distros --- .../ref/CoreFx.Private.TestUtilities.cs | 3 ++ .../src/System/PlatformDetection.Unix.cs | 3 ++ .../src/System/PlatformDetection.Windows.cs | 3 ++ .../NegotiateStreamTestForUnix.cs | 35 ++++++++++++++----- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs b/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs index 97be5d7274c5..e9b82e16bbe7 100644 --- a/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs +++ b/src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs @@ -77,6 +77,9 @@ public static partial class PlatformDetection public static Version ICUVersion { get { return null; } } public static bool IsUbuntu { get { throw null; } } public static bool IsUbuntu1404 { get { throw null; } } + public static bool IsUbuntu1604 { get { throw null; } } + public static bool IsUbuntu1704 { get { throw null; } } + public static bool IsUbuntu1710 { get { throw null; } } public static bool IsWindows { get { throw null; } } public static bool IsWindows10InsiderPreviewBuild16215OrGreater { get { throw null; } } public static bool IsWindows10Version1607OrGreater { get { throw null; } } diff --git a/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs b/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs index b606cb5ee982..abb86f939948 100644 --- a/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs +++ b/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Unix.cs @@ -33,6 +33,9 @@ public static partial class PlatformDetection public static bool IsDebian => IsDistroAndVersion("debian"); public static bool IsDebian8 => IsDistroAndVersion("debian", "8"); public static bool IsUbuntu1404 => IsDistroAndVersion("ubuntu", "14.04"); + public static bool IsUbuntu1604 => IsDistroAndVersion("ubuntu", "16.04"); + public static bool IsUbuntu1704 => IsDistroAndVersion("ubuntu", "17.04"); + public static bool IsUbuntu1710 => IsDistroAndVersion("ubuntu", "17.10"); public static bool IsCentos7 => IsDistroAndVersion("centos", "7"); public static bool IsTizen => IsDistroAndVersion("tizen"); public static bool IsNotFedoraOrRedHatOrCentos => !IsDistroAndVersion("fedora") && !IsDistroAndVersion("rhel") && !IsDistroAndVersion("centos"); diff --git a/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs b/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs index 9d93f3c45e5a..ce31c9965a0a 100644 --- a/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs +++ b/src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.Windows.cs @@ -21,6 +21,9 @@ public static partial class PlatformDetection public static bool IsDebian => false; public static bool IsDebian8 => false; public static bool IsUbuntu1404 => false; + public static bool IsUbuntu1604 => false; + public static bool IsUbuntu1704 => false; + public static bool IsUbuntu1710 => false; public static bool IsCentos7 => false; public static bool IsTizen => false; public static bool IsNotFedoraOrRedHatOrCentos => true; diff --git a/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs b/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs index 531e79123309..8522a20c56aa 100644 --- a/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs +++ b/src/System.Net.Security/tests/FunctionalTests/NegotiateStreamTestForUnix.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -72,15 +73,31 @@ public bool CheckAndClearCredentials(ITestOutputHelper output) } // Clear the credentials - var startInfo = new ProcessStartInfo(KDestroyCmd); - startInfo.UseShellExecute = true; - startInfo.CreateNoWindow = true; - startInfo.Arguments = "-A"; - using (Process clearCreds = Process.Start(startInfo)) - { - clearCreds.WaitForExit(); - output.WriteLine("kdestroy returned {0}", clearCreds.ExitCode); - return (clearCreds.ExitCode == 0); + try + { + var startInfo = new ProcessStartInfo(KDestroyCmd); + startInfo.UseShellExecute = true; + startInfo.CreateNoWindow = true; + startInfo.Arguments = "-A"; + using (Process clearCreds = Process.Start(startInfo)) + { + clearCreds.WaitForExit(); + output.WriteLine("kdestroy returned {0}", clearCreds.ExitCode); + return (clearCreds.ExitCode == 0); + } + } + catch (Win32Exception) + { + // https://github.com/dotnet/corefx/issues/24000 + // on these distros right now + Assert.True(PlatformDetection.IsUbuntu1704 || + PlatformDetection.IsUbuntu1710 || + PlatformDetection.IsOpenSUSE || + PlatformDetection.IsFedora || + PlatformDetection.IsDebian || + PlatformDetection.IsCentos7); + + return false; } }