#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

@ -25,6 +25,8 @@ namespace Ocelot.AcceptanceTests
[Fact]
public void should_return_reason_phrase()
{
var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -38,7 +40,7 @@ namespace Ocelot.AcceptanceTests
new FileHostAndPort
{
Host = "localhost",
Port = 51339,
Port = port,
}
},
UpstreamPathTemplate = "/",
@ -47,7 +49,7 @@ namespace Ocelot.AcceptanceTests
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51339", "/", "some reason"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", "/", "some reason"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))