mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 14:02:49 +08:00
parent
669ece07b2
commit
388b1fad90
@ -24,7 +24,7 @@
|
||||
|
||||
public string TimeoutStrategy { get; }
|
||||
|
||||
public bool UseQos => ExceptionsAllowedBeforeBreaking > 0 && TimeoutValue > 0;
|
||||
public bool UseQos => ExceptionsAllowedBeforeBreaking > 0 || TimeoutValue > 0;
|
||||
|
||||
public string Key { get; }
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
namespace Ocelot.UnitTests.Requester
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
@ -13,9 +15,6 @@ using Ocelot.Responses;
|
||||
using Shouldly;
|
||||
using TestStack.BDDfy;
|
||||
using Xunit;
|
||||
|
||||
namespace Ocelot.UnitTests.Requester
|
||||
{
|
||||
using Responder;
|
||||
|
||||
public class DelegatingHandlerHandlerProviderFactoryTests
|
||||
@ -302,6 +301,26 @@ namespace Ocelot.UnitTests.Requester
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_return_provider_with_qos_delegate_when_timeout_value_set()
|
||||
{
|
||||
var qosOptions = new QoSOptionsBuilder()
|
||||
.WithTimeoutValue(1)
|
||||
.Build();
|
||||
|
||||
var reRoute = new DownstreamReRouteBuilder()
|
||||
.WithQosOptions(qosOptions)
|
||||
.WithHttpHandlerOptions(new HttpHandlerOptions(true, true, false, true)).WithLoadBalancerKey("").Build();
|
||||
|
||||
this.Given(x => GivenTheFollowingRequest(reRoute))
|
||||
.And(x => GivenTheQosFactoryReturns(new FakeQoSHandler()))
|
||||
.And(x => GivenTheServiceProviderReturnsNothing())
|
||||
.When(x => WhenIGet())
|
||||
.Then(x => ThenThereIsDelegatesInProvider(1))
|
||||
.And(x => ThenItIsQosHandler(0))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_log_error_and_return_no_qos_provider_delegate_when_qos_factory_returns_error()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user