From a9a8f45158196b0e69d63cbf767a132ab72b4d2e Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Fri, 14 Apr 2017 10:48:44 -0700 Subject: [PATCH] change autobahn tests to use dynamic port (#167) --- test/AutobahnTestApp/Program.cs | 2 +- .../Autobahn/AutobahnTester.cs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/test/AutobahnTestApp/Program.cs b/test/AutobahnTestApp/Program.cs index d056f14262..9349f21aab 100644 --- a/test/AutobahnTestApp/Program.cs +++ b/test/AutobahnTestApp/Program.cs @@ -27,7 +27,7 @@ namespace AutobahnTestApp else if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ASPNETCORE_PORT"))) { // ANCM is hosting the process. - // The port will not yet be configure at this point, but will also not require HTTPS. + // The port will not yet be configured at this point, but will also not require HTTPS. builder.UseKestrel(); } else diff --git a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs index 5d2e6f44a1..50ac782996 100644 --- a/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs +++ b/test/Microsoft.AspNetCore.WebSockets.ConformanceTest/Autobahn/AutobahnTester.cs @@ -16,7 +16,6 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn { public class AutobahnTester : IDisposable { - private int _nextPort; private readonly List _deployers = new List(); private readonly List _expectations = new List(); private readonly ILoggerFactory _loggerFactory; @@ -24,11 +23,8 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn public AutobahnSpec Spec { get; } - public AutobahnTester(ILoggerFactory loggerFactory, AutobahnSpec baseSpec) : this(7000, loggerFactory, baseSpec) { } - - public AutobahnTester(int startPort, ILoggerFactory loggerFactory, AutobahnSpec baseSpec) + public AutobahnTester(ILoggerFactory loggerFactory, AutobahnSpec baseSpec) { - _nextPort = startPort; _loggerFactory = loggerFactory; _logger = _loggerFactory.CreateLogger("AutobahnTester"); @@ -89,8 +85,7 @@ namespace Microsoft.AspNetCore.WebSockets.ConformanceTest.Autobahn public async Task DeployTestAndAddToSpec(ServerType server, bool ssl, string environment, CancellationToken cancellationToken, Action expectationConfig = null) { - var port = Interlocked.Increment(ref _nextPort); - var baseUrl = ssl ? $"https://localhost:{port}" : $"http://localhost:{port}"; + var baseUrl = ssl ? "https://localhost:0" : "http://localhost:0"; var sslNamePart = ssl ? "SSL" : "NoSSL"; var name = $"{server}|{sslNamePart}|{environment}"; var logger = _loggerFactory.CreateLogger($"AutobahnTestApp:{server}:{sslNamePart}:{environment}");