mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-28 13:52:51 +08:00

* #568 Ocelot wont start if QoSOptions specified and no QoS DelegatingHandler registered e.g. no use of Ocelot.Provider.Polly. Also adds a NoQosDelegatingHandler and logs an error if ive missed something and the user can get to making the request * #568 sadly something wierd with IServiceProvider and FluentValidation so I'm just defaulting to warning and noqosdelegatinghandler if someone doesnt register but provides options, also added basic in memory cache in case people dont use a specific package
54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
namespace Ocelot.AcceptanceTests
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Ocelot.Configuration.File;
|
|
using Shouldly;
|
|
using Xunit;
|
|
|
|
public class CannotStartOcelotTests : IDisposable
|
|
{
|
|
private readonly Steps _steps;
|
|
|
|
public CannotStartOcelotTests()
|
|
{
|
|
_steps = new Steps();
|
|
}
|
|
|
|
[Fact]
|
|
public void should_throw_exception_if_cannot_start()
|
|
{
|
|
var invalidConfig = new FileConfiguration()
|
|
{
|
|
ReRoutes = new List<FileReRoute>
|
|
{
|
|
new FileReRoute
|
|
{
|
|
UpstreamPathTemplate = "api",
|
|
DownstreamPathTemplate = "test"
|
|
}
|
|
}
|
|
};
|
|
|
|
Exception exception = null;
|
|
_steps.GivenThereIsAConfiguration(invalidConfig);
|
|
try
|
|
{
|
|
_steps.GivenOcelotIsRunning();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
exception = ex;
|
|
}
|
|
|
|
exception.ShouldNotBeNull();
|
|
exception.Message.ShouldBe("One or more errors occurred. (Unable to start Ocelot, errors are: Downstream Path Template test doesnt start with forward slash,Upstream Path Template api doesnt start with forward slash,When not using service discovery DownstreamHostAndPorts must be set and not empty or Ocelot cannot find your service!)");
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_steps.Dispose();
|
|
}
|
|
}
|
|
}
|