#1115 find available ports to use in acceptance tests

This commit is contained in:
jlukawska
2020-03-06 10:18:21 +01:00
parent 0af49617ee
commit 263f26ed51
37 changed files with 653 additions and 381 deletions

View File

@ -20,7 +20,7 @@ namespace Ocelot.AcceptanceTests
{
private readonly Steps _steps;
private IWebHost _identityServerBuilder;
private string _identityServerRootUrl = "http://localhost:51888";
private string _identityServerRootUrl;
private string _downstreamServicePath = "/";
private string _downstreamServiceHost = "localhost";
private string _downstreamServiceScheme = "http";
@ -31,7 +31,9 @@ namespace Ocelot.AcceptanceTests
public AuthenticationTests()
{
_serviceHandler = new ServiceHandler();
_steps = new Steps();
_steps = new Steps();
var identityServerPort = RandomPortFinder.GetRandomPort();
_identityServerRootUrl = $"http://localhost:{identityServerPort}";
_options = o =>
{
o.Authority = _identityServerRootUrl;
@ -45,7 +47,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_401_using_identity_server_access_token()
{
int port = 54329;
int port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
@ -86,7 +88,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_200_using_identity_server()
{
int port = 54099;
int port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
@ -129,7 +131,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_response_401_using_identity_server_with_token_requested_for_other_api()
{
int port = 54196;
int port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
@ -171,7 +173,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_201_using_identity_server_access_token()
{
int port = 52226;
int port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
@ -214,7 +216,7 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_201_using_identity_server_reference_token()
{
int port = 52222;
int port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{