Don't fail tests if port 5000 is in use (#1650)

This commit is contained in:
Stephen Halter 2017-04-11 23:13:59 -07:00 committed by David Fowler
parent 99278c4691
commit db159190bd
1 changed files with 29 additions and 8 deletions

View File

@ -34,6 +34,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
await RegisterAddresses_Success(addressInput, testUrls);
}
[ConditionalTheory, MemberData(nameof(AddressRegistrationDataIPv4Port5000Default))]
[PortSupportedCondition(5000)]
public async Task RegisterAddresses_IPv4Port5000Default_Success(string addressInput, Func<IServerAddressesFeature, string[]> testUrls)
{
await RegisterAddresses_Success(addressInput, testUrls);
}
[ConditionalTheory, MemberData(nameof(AddressRegistrationDataIPv4Port80))]
[PortSupportedCondition(80)]
public async Task RegisterAddresses_IPv4Port80_Success(string addressInput, Func<IServerAddressesFeature, string[]> testUrls)
@ -63,6 +70,14 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
await RegisterAddresses_Success(addressInput, testUrls);
}
[ConditionalTheory, MemberData(nameof(AddressRegistrationDataIPv6Port5000Default))]
[IPv6SupportedCondition]
[PortSupportedCondition(5000)]
public async Task RegisterAddresses_IPv6Port5000Default_Success(string addressInput, Func<IServerAddressesFeature, string[]> testUrls)
{
await RegisterAddresses_Success(addressInput, testUrls);
}
[ConditionalTheory, MemberData(nameof(AddressRegistrationDataIPv6Port80))]
[IPv6SupportedCondition]
[PortSupportedCondition(80)]
@ -273,10 +288,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var dataset = new TheoryData<string, Func<IServerAddressesFeature, string[]>>();
// Default host and port
dataset.Add(null, _ => new[] { "http://127.0.0.1:5000/" });
dataset.Add(string.Empty, _ => new[] { "http://127.0.0.1:5000/" });
// Static ports
var port = GetNextPort();
@ -305,6 +316,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
}
}
public static TheoryData<string, Func<IServerAddressesFeature, string[]>> AddressRegistrationDataIPv4Port5000Default =>
new TheoryData<string, Func<IServerAddressesFeature, string[]>>
{
{ null, _ => new[] { "http://127.0.0.1:5000/" } },
{ string.Empty, _ => new[] { "http://127.0.0.1:5000/" } }
};
public static TheoryData<IPEndPoint, Func<IPEndPoint, string>> IPEndPointRegistrationDataRandomPort
{
get
@ -384,10 +402,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
{
var dataset = new TheoryData<string, Func<IServerAddressesFeature, string[]>>();
// Default host and port
dataset.Add(null, _ => new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" });
dataset.Add(string.Empty, _ => new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" });
// Static ports
var port = GetNextPort();
@ -422,6 +436,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests
}
}
public static TheoryData<string, Func<IServerAddressesFeature, string[]>> AddressRegistrationDataIPv6Port5000Default =>
new TheoryData<string, Func<IServerAddressesFeature, string[]>>
{
{ null, _ => new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" } },
{ string.Empty, _ => new[] { "http://127.0.0.1:5000/", "http://[::1]:5000/" } }
};
public static TheoryData<string, Func<IServerAddressesFeature, string[]>> AddressRegistrationDataIPv6Port80
{
get