mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 14:58:16 +08:00
tweaks
This commit is contained in:
@ -46,6 +46,7 @@ namespace Ocelot.AcceptanceTests
|
||||
using ConfigurationBuilder = Microsoft.Extensions.Configuration.ConfigurationBuilder;
|
||||
using CookieHeaderValue = Microsoft.Net.Http.Headers.CookieHeaderValue;
|
||||
using MediaTypeHeaderValue = System.Net.Http.Headers.MediaTypeHeaderValue;
|
||||
using Ocelot.Tracing.OpenTracing;
|
||||
|
||||
public class Steps : IDisposable
|
||||
{
|
||||
@ -1214,6 +1215,41 @@ namespace Ocelot.AcceptanceTests
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
internal void GivenOcelotIsRunningUsingOpenTracing(OpenTracing.ITracer fakeTracer)
|
||||
{
|
||||
_webHostBuilder = new WebHostBuilder();
|
||||
|
||||
_webHostBuilder
|
||||
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||
{
|
||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||
var env = hostingContext.HostingEnvironment;
|
||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||
config.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureServices(s =>
|
||||
{
|
||||
s.AddOcelot()
|
||||
.AddOpenTracing();
|
||||
|
||||
s.AddSingleton<OpenTracing.ITracer>(fakeTracer);
|
||||
})
|
||||
.Configure(app =>
|
||||
{
|
||||
app.Use(async (_, next) =>
|
||||
{
|
||||
await next.Invoke();
|
||||
});
|
||||
app.UseOcelot().Wait();
|
||||
});
|
||||
|
||||
_ocelotServer = new TestServer(_webHostBuilder);
|
||||
|
||||
_ocelotClient = _ocelotServer.CreateClient();
|
||||
}
|
||||
|
||||
public void ThenWarningShouldBeLogged()
|
||||
{
|
||||
MockLoggerFactory loggerFactory = (MockLoggerFactory)_ocelotServer.Host.Services.GetService<IOcelotLoggerFactory>();
|
||||
|
Reference in New Issue
Block a user