mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 14:10:50 +08:00 
			
		
		
		
	made benchmark work
This commit is contained in:
		@@ -27,6 +27,7 @@ using BenchmarkDotNet.Validators;
 | 
				
			|||||||
using Ocelot.DownstreamRouteFinder.Middleware;
 | 
					using Ocelot.DownstreamRouteFinder.Middleware;
 | 
				
			||||||
using Ocelot.DownstreamRouteFinder.Finder;
 | 
					using Ocelot.DownstreamRouteFinder.Finder;
 | 
				
			||||||
using Ocelot.Middleware.Multiplexer;
 | 
					using Ocelot.Middleware.Multiplexer;
 | 
				
			||||||
 | 
					using Ocelot.Configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Ocelot.Benchmarks
 | 
					namespace Ocelot.Benchmarks
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -54,7 +55,6 @@ namespace Ocelot.Benchmarks
 | 
				
			|||||||
            var services = serviceCollection.BuildServiceProvider();
 | 
					            var services = serviceCollection.BuildServiceProvider();
 | 
				
			||||||
            var loggerFactory = services.GetService<IOcelotLoggerFactory>();
 | 
					            var loggerFactory = services.GetService<IOcelotLoggerFactory>();
 | 
				
			||||||
            var drpf = services.GetService<IDownstreamRouteProviderFactory>();
 | 
					            var drpf = services.GetService<IDownstreamRouteProviderFactory>();
 | 
				
			||||||
            var icr = services.GetService<IInternalConfigurationRepository>();
 | 
					 | 
				
			||||||
            var multiplexer = services.GetService<IMultiplexer>();
 | 
					            var multiplexer = services.GetService<IMultiplexer>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            _next = async context => {
 | 
					            _next = async context => {
 | 
				
			||||||
@@ -62,8 +62,16 @@ namespace Ocelot.Benchmarks
 | 
				
			|||||||
                throw new Exception("BOOM");
 | 
					                throw new Exception("BOOM");
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            _middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, icr, multiplexer);
 | 
					            _middleware = new DownstreamRouteFinderMiddleware(_next, loggerFactory, drpf, multiplexer);
 | 
				
			||||||
            _downstreamContext = new DownstreamContext(new DefaultHttpContext());
 | 
					            var httpContext = new DefaultHttpContext();
 | 
				
			||||||
 | 
					            httpContext.Request.Path = new PathString("/test");
 | 
				
			||||||
 | 
					            httpContext.Request.QueryString = new QueryString("?a=b");
 | 
				
			||||||
 | 
					            httpContext.Request.Headers.Add("Host", "most");
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            _downstreamContext = new DownstreamContext(httpContext)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                Configuration = new InternalConfiguration(new List<ReRoute>(), null, null, null, null, null, null, null)
 | 
				
			||||||
 | 
					            };
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        [Benchmark(Baseline = true)]
 | 
					        [Benchmark(Baseline = true)]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,8 @@ namespace Ocelot.Benchmarks
 | 
				
			|||||||
                    typeof(DictionaryBenchmarks),
 | 
					                    typeof(DictionaryBenchmarks),
 | 
				
			||||||
                    typeof(UrlPathToUrlPathTemplateMatcherBenchmarks),
 | 
					                    typeof(UrlPathToUrlPathTemplateMatcherBenchmarks),
 | 
				
			||||||
                    typeof(AllTheThingsBenchmarks),
 | 
					                    typeof(AllTheThingsBenchmarks),
 | 
				
			||||||
                    typeof(ExceptionHandlerMiddlewareBenchmarks)
 | 
					                    typeof(ExceptionHandlerMiddlewareBenchmarks),
 | 
				
			||||||
 | 
					                    typeof(DownstreamRouteFinderMiddlewareBenchmarks)
 | 
				
			||||||
               });
 | 
					               });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            switcher.Run(args);
 | 
					            switcher.Run(args);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user