#492 log 500 with error log level, acceptance test, unit test

This commit is contained in:
jlukawska
2019-11-07 09:18:05 +01:00
parent f4c9e2a737
commit f0667471dd
5 changed files with 120 additions and 2 deletions

View File

@ -20,7 +20,8 @@
[Fact]
public void should_return_internal_server_error_if_downstream_service_returns_internal_server_error()
{
{
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
@ -49,6 +50,39 @@
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.InternalServerError))
.BDDfy();
}
[Fact]
public void should_log_error_if_downstream_service_returns_internal_server_error()
{
var configuration = new FileConfiguration
{
ReRoutes = new List<FileReRoute>
{
new FileReRoute
{
DownstreamPathTemplate = "/",
UpstreamPathTemplate = "/",
UpstreamHttpMethod = new List<string> { "Get" },
DownstreamHostAndPorts = new List<FileHostAndPort>
{
new FileHostAndPort
{
Host = "localhost",
Port = 53876,
},
},
DownstreamScheme = "http",
},
},
};
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53876"))
.And(x => _steps.GivenThereIsAConfiguration(configuration))
.And(x => _steps.GivenOcelotIsRunningWithLogger())
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
.Then(x => _steps.ThenErrorShouldBeLogged())
.BDDfy();
}
private void GivenThereIsAServiceRunningOn(string url)