From de197bfcd13ea1da7fa2b8c67372ab380352d648 Mon Sep 17 00:00:00 2001 From: Hao Kung Date: Thu, 21 Jun 2018 14:27:48 -0700 Subject: [PATCH] Use dynamic ports for Https/Ntlm tests (#874) --- .../OutOfProcess/HttpsTest.cs | 11 +++++++---- .../OutOfProcess/NtlmAuthentationTest.cs | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs index 5667b0b6b1..15f3c5f3b9 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/HttpsTest.cs @@ -6,6 +6,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; using IISIntegration.FunctionalTests.Utilities; using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Server.IntegrationTesting.Common; using Microsoft.AspNetCore.Testing.xunit; using Xunit; using Xunit.Abstractions; @@ -30,10 +31,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public async Task HttpsHelloWorld(TestVariant variant) { + var port = TestPortHelper.GetNextSSLPort(); var deploymentParameters = new DeploymentParameters(variant) { ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(), - ApplicationBaseUriHint = "https://localhost:44394/", + ApplicationBaseUriHint = $"https://localhost:{port}/", ServerConfigTemplateContent = GetHttpsServerConfig() }; @@ -53,7 +55,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [MemberData(nameof(TestVariants))] public Task HttpsHelloWorld_NoClientCert(TestVariant variant) { - return HttpsHelloWorldCerts(variant, port: 44397, sendClientCert: false); + return HttpsHelloWorldCerts(variant, sendClientCert: false); } #pragma warning disable xUnit1004 // Test methods should not be skipped @@ -62,11 +64,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests #pragma warning restore xUnit1004 // Test methods should not be skipped public Task HttpsHelloWorld_ClientCert(TestVariant variant) { - return HttpsHelloWorldCerts(variant, port: 44301, sendClientCert: true); + return HttpsHelloWorldCerts(variant, sendClientCert: true); } - private async Task HttpsHelloWorldCerts(TestVariant variant, int port, bool sendClientCert) + private async Task HttpsHelloWorldCerts(TestVariant variant, bool sendClientCert) { + var port = TestPortHelper.GetNextSSLPort(); var deploymentParameters = new DeploymentParameters(variant) { ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(), diff --git a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs index d75223aa7b..39ae2fe0e3 100644 --- a/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs +++ b/test/IISIntegration.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs @@ -1,7 +1,6 @@ // 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.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; @@ -31,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var deploymentParameters = new DeploymentParameters(variant) { ApplicationPath = Helpers.GetOutOfProcessTestSitesPath(), - ApplicationBaseUriHint = "http://localhost:5052" + ApplicationBaseUriHint = $"http://localhost:0/", }; var result = await DeployAsync(deploymentParameters);