Closed raman-m closed 10 months ago
@ggnaegi What about next coding challenge? 😉
@raman-m Well, it's very odd... At some point, we have a timing problem... It's very difficult to manage. First I thought, ok instead of using the local variable _requestCount, let's inject a singleton IRequestCountService like this:
.ConfigureServices(services =>
{
services.AddSingleton<IRequestCountService, RequestCountService>();
})
and then refactor the method like that:
private void GivenThereIsAPossiblyBrokenServiceRunningOn(string url, string responseBody)
{
_serviceHandler.GivenThereIsAServiceRunningOn(url, async context =>
{
var requestCountService = context.RequestServices.GetService<IRequestCountService>();
context.Response.StatusCode = 200;
if (requestCountService.GetRequestCount() == 1)
{
await Task.Delay(1000);
await context.Response.WriteAsync("delayed service");
return;
}
await context.Response.WriteAsync(responseBody);
});
}
It brings a bit more stability, but that's not it yet, failing after 200-300 iterations I think
200-300 iterations
After what number of iterations we have a fail of the test now?
You are assigned! Okay?
@raman-m I will have a go on this next week (wednesday probably)
Expected Behavior / New Feature
The test
Ocelot.AcceptanceTests.PollyQoSTests.Open_circuit_should_not_effect_different_route
doesn't fail in 100% of runningActual Behavior / Motivation for New Feature
Currently the test Open_circuit_should_not_effect_different_route fails sometimes, very rarely. Possible reason: unknown.
Steps to Reproduce the Problem
Specifications