mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 07:35:27 +08:00 
			
		
		
		
	Feature/automatic routes with sd (#351)
* #340 started looking at supporting automatic routing when using service discovery * #340 getting old routing tests to pass * #340 renamed stuff to provider rather than finder, as its not longer finding anything * #340 working towards supporting dynamic routing * #340 loads of refactoring to make configuration work with dynamic routing * #340 refactor consul config code so the registry class owns it * #340 default to consul to maintain backwards compat * #340 added docs, finished this branches todos
This commit is contained in:
		@@ -33,7 +33,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        public void should_store_load_balancer_on_first_request()
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithReRouteKey("test")
 | 
			
		||||
                .WithLoadBalancerKey("test")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenThereIsALoadBalancer(reRoute, new FakeLoadBalancer()))
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancerOptions(new LoadBalancerOptions("FakeLoadBalancer", "", 0))
 | 
			
		||||
                .WithReRouteKey("test")
 | 
			
		||||
                .WithLoadBalancerKey("test")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenThereIsALoadBalancer(reRoute, new FakeLoadBalancer()))
 | 
			
		||||
@@ -60,12 +60,12 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancerOptions(new LoadBalancerOptions("FakeLoadBalancer", "", 0))
 | 
			
		||||
                .WithReRouteKey("test")
 | 
			
		||||
                .WithLoadBalancerKey("test")
 | 
			
		||||
                .Build();
 | 
			
		||||
            
 | 
			
		||||
            var reRouteTwo = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancerOptions(new LoadBalancerOptions("FakeRoundRobinLoadBalancer", "", 0))
 | 
			
		||||
                .WithReRouteKey("testtwo")
 | 
			
		||||
                .WithLoadBalancerKey("testtwo")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenThereIsALoadBalancer(reRoute, new FakeLoadBalancer()))
 | 
			
		||||
@@ -92,12 +92,12 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        {
 | 
			
		||||
            var reRoute = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancerOptions(new LoadBalancerOptions("FakeLoadBalancer", "", 0))
 | 
			
		||||
                .WithReRouteKey("test")
 | 
			
		||||
                .WithLoadBalancerKey("test")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            var reRouteTwo = new DownstreamReRouteBuilder()
 | 
			
		||||
                .WithLoadBalancerOptions(new LoadBalancerOptions("LeastConnection", "", 0))
 | 
			
		||||
                .WithReRouteKey("test")
 | 
			
		||||
                .WithLoadBalancerKey("test")
 | 
			
		||||
                .Build();
 | 
			
		||||
 | 
			
		||||
            this.Given(x => x.GivenThereIsALoadBalancer(reRoute, new FakeLoadBalancer()))
 | 
			
		||||
 
 | 
			
		||||
@@ -117,7 +117,8 @@ namespace Ocelot.UnitTests.LoadBalancer
 | 
			
		||||
        private void GivenTheConfigurationIs(ServiceProviderConfiguration config)
 | 
			
		||||
        {
 | 
			
		||||
            _config = config;
 | 
			
		||||
            _downstreamContext.ServiceProviderConfiguration = config;
 | 
			
		||||
            var configuration = new InternalConfiguration(null, null, config, null, null, null, null, null);
 | 
			
		||||
            _downstreamContext.Configuration = configuration;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void GivenTheDownStreamUrlIs(string downstreamUrl)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user