mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 16:10:50 +08:00 
			
		
		
		
	#349 default to no load balancer so that in load balaner house we dont always rebuild the loadbalancer infrastructure because the load balancer options type is null (#358)
This commit is contained in:
		@@ -1,10 +1,12 @@
 | 
				
			|||||||
 | 
					using Ocelot.LoadBalancer.LoadBalancers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Ocelot.Configuration
 | 
					namespace Ocelot.Configuration
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    public class LoadBalancerOptions
 | 
					    public class LoadBalancerOptions
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public LoadBalancerOptions(string type, string key, int expiryInMs)
 | 
					        public LoadBalancerOptions(string type, string key, int expiryInMs)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Type = type;
 | 
					            Type = type ?? nameof(NoLoadBalancer);
 | 
				
			||||||
            Key = key;
 | 
					            Key = key;
 | 
				
			||||||
            ExpiryInMs = expiryInMs;
 | 
					            ExpiryInMs = expiryInMs;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					using Ocelot.Configuration;
 | 
				
			||||||
 | 
					using Ocelot.LoadBalancer.LoadBalancers;
 | 
				
			||||||
 | 
					using Shouldly;
 | 
				
			||||||
 | 
					using Xunit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Ocelot.UnitTests.LoadBalancer
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public class LoadBalancerOptionsTests
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        [Fact]
 | 
				
			||||||
 | 
					        public void should_default_to_no_load_balancer()
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            var options = new LoadBalancerOptionsBuilder().Build();
 | 
				
			||||||
 | 
					            options.Type.ShouldBe(nameof(NoLoadBalancer));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user