diff --git a/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs b/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs index 9d6c376e3247..f1fcec949bda 100644 --- a/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs +++ b/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs @@ -129,12 +129,13 @@ public async Task RegisterAddresses_IPv6_Success(string addressInput, string[] t } [ConditionalTheory] - [MemberData(nameof(AddressRegistrationDataIPv6Port5000Default))] + [MemberData(nameof(AddressRegistrationDataIPv6Port5000And5001Default))] [IPv6SupportedCondition] [QuarantinedTest("https://github.com/dotnet/aspnetcore-internal/issues/2711")] - public async Task RegisterAddresses_IPv6Port5000Default_Success(string addressInput, string[] testUrls) + public async Task RegisterAddresses_IPv6Port5000And5001Default_Success(string addressInput, string[] testUrls) { - if (!CanBindToEndpoint(IPAddress.Loopback, 5000) || !CanBindToEndpoint(IPAddress.IPv6Loopback, 5000)) + if ((!CanBindToEndpoint(IPAddress.Loopback, 5000) || !CanBindToEndpoint(IPAddress.IPv6Loopback, 5000)) && + (!CanBindToEndpoint(IPAddress.Loopback, 5001) || !CanBindToEndpoint(IPAddress.IPv6Loopback, 5001))) { return; } @@ -183,7 +184,13 @@ public async Task RegisterAddresses_IPv6LocalhostStaticPort_Success() private async Task RegisterAddresses_Success(string addressInput, string[] testUrls, int testPort = 0) { var hostBuilder = TransportSelector.GetWebHostBuilder() - .UseKestrel() + .UseKestrel(serverOptions => + { + serverOptions.ConfigureHttpsDefaults(httpsOptions => + { + httpsOptions.ServerCertificate = TestResources.GetTestCertificate(); + }); + }) .ConfigureServices(AddTestLogging) .UseUrls(addressInput) .Configure(ConfigureEchoAddress); @@ -1038,11 +1045,11 @@ public static TheoryData AddressRegistrationDataIPv6 } } - public static TheoryData AddressRegistrationDataIPv6Port5000Default => + public static TheoryData AddressRegistrationDataIPv6Port5000And5001Default => new TheoryData { - { null, new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" } }, - { string.Empty, new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" } } + { null, new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/", "https://127.0.0.1:5001/", "https://[::1]:5001/" } }, + { string.Empty, new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/", "https://127.0.0.1:5001/", "https://[::1]:5001/" } } }; public static TheoryData AddressRegistrationDataIPv6Port80 =>