Support placeholder in service fabric services names (#722)

This commit is contained in:
Felix Boers
2019-01-11 14:54:54 +01:00
committed by Phil Proctor
parent 7ba6d303b4
commit 6495891a07
6 changed files with 90 additions and 12 deletions

View File

@ -128,6 +128,42 @@ namespace Ocelot.AcceptanceTests
.BDDfy();
}
[Fact]
public void should_support_placeholder_in_service_fabric_service_name()
{
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
{
new FileReRoute
{
DownstreamPathTemplate = "/values",
DownstreamScheme = "http",
UpstreamPathTemplate = "/api/{version}/values",
UpstreamHttpMethod = new List<string> { "Get" },
ServiceName = "Service_{version}/Api"
}
},
GlobalConfiguration = new FileGlobalConfiguration
{
ServiceDiscoveryProvider = new FileServiceDiscoveryProvider()
{
Host = "localhost",
Port = 19081,
Type = "ServiceFabric"
}
}
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:19081", "/Service_1.0/Api/values", 200, "Hello from Laura", "test=best"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunning())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/api/1.0/values?test=best"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
.BDDfy();
}
private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int statusCode, string responseBody, string expectedQueryString)
{
_serviceHandler.GivenThereIsAServiceRunningOn(baseUrl, basePath, async context =>