#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

@ -37,7 +37,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -51,7 +53,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -61,7 +63,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -80,7 +82,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -94,7 +98,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -104,7 +108,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -123,7 +127,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -137,7 +143,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -147,7 +153,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -166,7 +172,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -180,7 +188,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -190,7 +198,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -209,7 +217,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -223,7 +233,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -233,7 +243,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -252,7 +262,9 @@
_counter++;
await next.Invoke();
}
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -266,7 +278,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41879,
Port = port,
}
},
DownstreamScheme = "http",
@ -276,7 +288,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41879", 200, ""))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, ""))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunning(configuration))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
@ -299,7 +311,9 @@
}
return Task.CompletedTask;
};
};
var port = RandomPortFinder.GetRandomPort();
var fileConfiguration = new FileConfiguration
{
@ -313,7 +327,7 @@
new FileHostAndPort
{
Host = "localhost",
Port = 41880,
Port = port,
}
},
DownstreamScheme = "http",
@ -323,7 +337,7 @@
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:41880", 200, "/test"))
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}", 200, "/test"))
.And(x => _steps.GivenThereIsAConfiguration(fileConfiguration, _configurationPath))
.And(x => _steps.GivenOcelotIsRunningWithMiddleareBeforePipeline<FakeMiddleware>(callback))
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))