diff --git a/test/Ocelot.AcceptanceTests/HttpTests.cs b/test/Ocelot.AcceptanceTests/HttpTests.cs index b63ad4bb..57947d07 100644 --- a/test/Ocelot.AcceptanceTests/HttpTests.cs +++ b/test/Ocelot.AcceptanceTests/HttpTests.cs @@ -25,7 +25,7 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_using_http_one() { - const int port = 53219; + var port = RandomPortFinder.GetRandomPort(); var configuration = new FileConfiguration { @@ -63,7 +63,7 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_using_http_one_point_one() { - const int port = 53279; + var port = RandomPortFinder.GetRandomPort(); var configuration = new FileConfiguration { @@ -101,7 +101,7 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_using_http_two_point_zero() { - const int port = 53675; + var port = RandomPortFinder.GetRandomPort(); var configuration = new FileConfiguration { @@ -143,7 +143,7 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_500_when_using_http_one_to_talk_to_server_running_http_two() { - const int port = 53677; + var port = RandomPortFinder.GetRandomPort(); var configuration = new FileConfiguration { @@ -184,7 +184,7 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_using_http_two_to_talk_to_server_running_http_one_point_one() { - const int port = 53679; + var port = RandomPortFinder.GetRandomPort(); var configuration = new FileConfiguration { diff --git a/test/Ocelot.AcceptanceTests/MethodTests.cs b/test/Ocelot.AcceptanceTests/MethodTests.cs index abfbfecf..e70dc7e1 100644 --- a/test/Ocelot.AcceptanceTests/MethodTests.cs +++ b/test/Ocelot.AcceptanceTests/MethodTests.cs @@ -24,6 +24,8 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_get_converted_to_post() { + var port = RandomPortFinder.GetRandomPort(); + var configuration = new FileConfiguration { ReRoutes = new List @@ -39,7 +41,7 @@ namespace Ocelot.AcceptanceTests new FileHostAndPort { Host = "localhost", - Port = 53171, + Port = port, }, }, DownstreamHttpMethod = "POST", @@ -47,7 +49,7 @@ namespace Ocelot.AcceptanceTests }, }; - this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53171/", "/", "POST")) + this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "POST")) .And(x => _steps.GivenThereIsAConfiguration(configuration)) .And(x => _steps.GivenOcelotIsRunning()) .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) @@ -58,6 +60,8 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_get_converted_to_post_with_content() { + var port = RandomPortFinder.GetRandomPort(); + var configuration = new FileConfiguration { ReRoutes = new List @@ -73,7 +77,7 @@ namespace Ocelot.AcceptanceTests new FileHostAndPort { Host = "localhost", - Port = 53271, + Port = port, }, }, DownstreamHttpMethod = "POST", @@ -84,7 +88,7 @@ namespace Ocelot.AcceptanceTests const string expected = "here is some content"; var httpContent = new StringContent(expected); - this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53271/", "/", "POST")) + this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "POST")) .And(x => _steps.GivenThereIsAConfiguration(configuration)) .And(x => _steps.GivenOcelotIsRunning()) .When(x => _steps.WhenIGetUrlOnTheApiGateway("/", httpContent)) @@ -96,6 +100,8 @@ namespace Ocelot.AcceptanceTests [Fact] public void should_return_response_200_when_get_converted_to_get_with_content() { + var port = RandomPortFinder.GetRandomPort(); + var configuration = new FileConfiguration { ReRoutes = new List @@ -111,7 +117,7 @@ namespace Ocelot.AcceptanceTests new FileHostAndPort { Host = "localhost", - Port = 53272, + Port = port, }, }, DownstreamHttpMethod = "GET", @@ -122,7 +128,7 @@ namespace Ocelot.AcceptanceTests const string expected = "here is some content"; var httpContent = new StringContent(expected); - this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53272/", "/", "GET")) + this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "GET")) .And(x => _steps.GivenThereIsAConfiguration(configuration)) .And(x => _steps.GivenOcelotIsRunning()) .When(x => _steps.WhenIPostUrlOnTheApiGateway("/", httpContent))