diff --git a/build/dependencies.props b/build/dependencies.props index fb4b95edd2..37cc74caba 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -14,7 +14,7 @@ 2.2.0-preview1-34694 2.2.0-preview1-34694 2.2.0-preview1-34694 - 0.6.0-preview1-34694 + 0.6.0-a-preview1-pk-rem-iis-17083 2.2.0-preview1-34694 2.2.0-preview1-34694 2.2.0-preview1-34694 diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/DotNetCommands.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/DotNetCommands.cs deleted file mode 100644 index aaa7ade405..0000000000 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/DotNetCommands.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace Microsoft.AspNetCore.Server.IntegrationTesting -{ - // Copied from hosting - // TODO: make public while removing IISExpressDeployer - public static class DotNetCommands - { - private const string _dotnetFolderName = ".dotnet"; - - internal static string DotNetHome { get; } = GetDotNetHome(); - - // Compare to https://github.com/aspnet/BuildTools/blob/314c98e4533217a841ff9767bb38e144eb6c93e4/tools/KoreBuild.Console/Commands/CommandContext.cs#L76 - private static string GetDotNetHome() - { - var dotnetHome = Environment.GetEnvironmentVariable("DOTNET_HOME"); - var userProfile = Environment.GetEnvironmentVariable("USERPROFILE"); - var home = Environment.GetEnvironmentVariable("HOME"); - - var result = Path.Combine(Directory.GetCurrentDirectory(), _dotnetFolderName); - if (!string.IsNullOrEmpty(dotnetHome)) - { - result = dotnetHome; - } - else if (!string.IsNullOrEmpty(userProfile)) - { - result = Path.Combine(userProfile, _dotnetFolderName); - } - else if (!string.IsNullOrEmpty(home)) - { - result = home; - } - - return result; - } - - internal static string GetDotNetInstallDir(RuntimeArchitecture arch) - { - var dotnetDir = DotNetHome; - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - dotnetDir = Path.Combine(dotnetDir, arch.ToString()); - } - - return dotnetDir; - } - - public static string GetDotNetExecutable(RuntimeArchitecture arch) - { - var dotnetDir = GetDotNetInstallDir(arch); - - var dotnetFile = "dotnet"; - - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - dotnetFile += ".exe"; - } - - return Path.Combine(dotnetDir, dotnetFile); - } - - internal static bool IsRunningX86OnX64(RuntimeArchitecture arch) - { - return (RuntimeInformation.OSArchitecture == Architecture.X64 || RuntimeInformation.OSArchitecture == Architecture.Arm64) - && arch == RuntimeArchitecture.x86; - } - } -} diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/TestUriHelper.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/TestUriHelper.cs index fe1b351ba4..e69de29bb2 100644 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/TestUriHelper.cs +++ b/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/TestUriHelper.cs @@ -1,58 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.AspNetCore.Server.IntegrationTesting.Common -{ - internal static class TestUriHelper - { - internal static Uri BuildTestUri(ServerType serverType, string hint) - { - // Assume status messages are enabled for Kestrel and disabled for all other servers. - var statusMessagesEnabled = (serverType == ServerType.Kestrel); - - return BuildTestUri(serverType, Uri.UriSchemeHttp, hint, statusMessagesEnabled); - } - - internal static Uri BuildTestUri(ServerType serverType, string scheme, string hint, bool statusMessagesEnabled) - { - if (string.IsNullOrEmpty(hint)) - { - if (serverType == ServerType.Kestrel && statusMessagesEnabled) - { - // Most functional tests use this codepath and should directly bind to dynamic port "0" and scrape - // the assigned port from the status message, which should be 100% reliable since the port is bound - // once and never released. Binding to dynamic port "0" on "localhost" (both IPv4 and IPv6) is not - // supported, so the port is only bound on "127.0.0.1" (IPv4). If a test explicitly requires IPv6, - // it should provide a hint URL with "localhost" (IPv4 and IPv6) or "[::1]" (IPv6-only). - return new UriBuilder(scheme, "127.0.0.1", 0).Uri; - } - else - { - // If the server type is not Kestrel, or status messages are disabled, there is no status message - // from which to scrape the assigned port, so the less reliable GetNextPort() must be used. The - // port is bound on "localhost" (both IPv4 and IPv6), since this is supported when using a specific - // (non-zero) port. - return new UriBuilder(scheme, "localhost", TestPortHelper.GetNextPort()).Uri; - } - } - else - { - var uriHint = new Uri(hint); - if (uriHint.Port == 0) - { - // Only a few tests use this codepath, so it's fine to use the less reliable GetNextPort() for simplicity. - // The tests using this codepath will be reviewed to see if they can be changed to directly bind to dynamic - // port "0" on "127.0.0.1" and scrape the assigned port from the status message (the default codepath). - return new UriBuilder(uriHint) { Port = TestPortHelper.GetNextPort() }.Uri; - } - else - { - // If the hint contains a specific port, return it unchanged. - return uriHint; - } - } - } - } -}