#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

@ -21,7 +21,9 @@
[Fact]
public void should_use_default_request_id_and_forward()
{
{
var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -34,7 +36,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 51873,
Port = port,
}
},
DownstreamScheme = "http",
@ -45,7 +47,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51873"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -55,7 +57,9 @@
[Fact]
public void should_use_request_id_and_forward()
{
{
var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -68,7 +72,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 51873,
Port = port,
}
},
DownstreamScheme = "http",
@ -80,7 +84,7 @@
var requestId = Guid.NewGuid().ToString();
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51873"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", requestId))
@ -90,7 +94,9 @@
[Fact]
public void should_use_global_request_id_and_forward()
{
{
var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -103,7 +109,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 51873,
Port = port,
}
},
DownstreamScheme = "http",
@ -119,7 +125,7 @@
var requestId = Guid.NewGuid().ToString();
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51873"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", requestId))
@ -129,7 +135,9 @@
[Fact]
public void should_use_global_request_id_create_and_forward()
{
{
var port = RandomPortFinder.GetRandomPort();
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -142,7 +150,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 51873,
Port = port,
}
},
DownstreamScheme = "http",
@ -156,7 +164,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51873"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))