ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.38k stars 1.64k forks source link

#1550 #1706 Addressing the QoS options ExceptionsAllowedBeforeBreaking issue #1753

Closed ggnaegi closed 1 year ago

ggnaegi commented 1 year ago

Fixes #1550 #1706

Proposed Changes

ggnaegi commented 1 year ago

@raman-m @RaynaldM This PR is ready for review.

I have added several unit tests:

Hopefully I have a solution for the possibly broken service, I have simplified the logic here: https://github.com/ThreeMammals/Ocelot/issues/1706

 private void GivenThereIsAPossiblyBrokenServiceRunningOn(string url, string responseBody)
    {
        var requestCount = 0;
        _serviceHandler.GivenThereIsAServiceRunningOn(url, async context =>
        {
            if (requestCount == 1)
            {
                await Task.Delay(1000);
            }

            requestCount++;
            context.Response.StatusCode = 200;
            await context.Response.WriteAsync(responseBody);
        });
    }
raman-m commented 1 year ago

Gui, would you like to include this fix in October release?

ggnaegi commented 1 year ago

Gui, would you like to include this fix in October release?

I think so yes.

raman-m commented 1 year ago

Gui, As you see, I've rebased feature branch... And I'll review tomorrow... Happy presentation tomorrow! 😉

ggnaegi commented 1 year ago

@raman-m are you sure that it's not a bit over-engineered? (FileConfiguration)

raman-m commented 1 year ago

@ggnaegi commented on Nov 3 a bit over-engineered?

Why not if I have some time for this... I agree that refactoring of tests doesn't provide much benefit. 🆗 I won't you bother on tests... Let's focus on real code...

raman-m commented 1 year ago

@ggnaegi Let me know you're 🆗 to merge plz? I'm going to add a couple of tiny fixes... So, it seems, this PR will be merged first than #1745 ... And you will need to apply new logger string-factories for all new logging operators being added by this PR.

raman-m commented 1 year ago

Regarding the Open_circuit_should_not_effect_different_route() test... Here are my testing results of 1000 runs for the test;

image

It is definitely stable now. But I don't know how to get CircleCI environment tests... Seems we have to watch for this test on CircleCI in the latest builds after merging PR...

Anyway, I would say, It should be stable now, and #1706 will not be reproducible after merging this PR. So, we could attach #1706 to this PR. Could we, Gui?

ggnaegi commented 1 year ago

Great!