mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 10:35:28 +08:00 
			
		
		
		
	identified tests are failing because sometimes more than one log entry in raft, this is deffo wrong, also made int tests not use cache manager
This commit is contained in:
		@@ -617,17 +617,7 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
                })
 | 
					                })
 | 
				
			||||||
                .ConfigureServices(x =>
 | 
					                .ConfigureServices(x =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Action<ConfigurationBuilderCachePart> settings = (s) =>
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        s.WithMicrosoftLogging(log =>
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                log.AddConsole(LogLevel.Debug);
 | 
					 | 
				
			||||||
                            })
 | 
					 | 
				
			||||||
                            .WithDictionaryHandle();
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    x.AddOcelot()
 | 
					                    x.AddOcelot()
 | 
				
			||||||
                        .AddCacheManager(settings)
 | 
					 | 
				
			||||||
                        .AddAdministration("/administration", "secret");
 | 
					                        .AddAdministration("/administration", "secret");
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                .Configure(app =>
 | 
					                .Configure(app =>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,8 @@ using Ocelot.Middleware;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Ocelot.IntegrationTests
 | 
					namespace Ocelot.IntegrationTests
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    using Xunit.Abstractions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public class RaftTests : IDisposable
 | 
					    public class RaftTests : IDisposable
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        private readonly List<IWebHost> _builders;
 | 
					        private readonly List<IWebHost> _builders;
 | 
				
			||||||
@@ -34,9 +36,11 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
        private BearerToken _token;
 | 
					        private BearerToken _token;
 | 
				
			||||||
        private HttpResponseMessage _response;
 | 
					        private HttpResponseMessage _response;
 | 
				
			||||||
        private static readonly object _lock = new object();
 | 
					        private static readonly object _lock = new object();
 | 
				
			||||||
 | 
					        private ITestOutputHelper _output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public RaftTests()
 | 
					        public RaftTests(ITestOutputHelper output)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            _output = output;
 | 
				
			||||||
            _httpClientForAssertions = new HttpClient();
 | 
					            _httpClientForAssertions = new HttpClient();
 | 
				
			||||||
            _httpClient = new HttpClient();
 | 
					            _httpClient = new HttpClient();
 | 
				
			||||||
            var ocelotBaseUrl = "http://localhost:5000";
 | 
					            var ocelotBaseUrl = "http://localhost:5000";
 | 
				
			||||||
@@ -160,9 +164,12 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
        private void WhenISendACommandIntoTheCluster(UpdateFileConfiguration command)
 | 
					        private void WhenISendACommandIntoTheCluster(UpdateFileConfiguration command)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            bool SendCommand()
 | 
					            bool SendCommand()
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    var p = _peers.Peers.First();
 | 
					                    var p = _peers.Peers.First();
 | 
				
			||||||
                var json = JsonConvert.SerializeObject(command,new JsonSerializerSettings() { 
 | 
					                    var json = JsonConvert.SerializeObject(command, new JsonSerializerSettings()
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
                        TypeNameHandling = TypeNameHandling.All
 | 
					                        TypeNameHandling = TypeNameHandling.All
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                    var httpContent = new StringContent(json);
 | 
					                    var httpContent = new StringContent(json);
 | 
				
			||||||
@@ -191,6 +198,12 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    return false;
 | 
					                    return false;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                catch (Exception e)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    Console.WriteLine(e);
 | 
				
			||||||
 | 
					                    return false;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            var commandSent = WaitFor(20000).Until(() => SendCommand());
 | 
					            var commandSent = WaitFor(20000).Until(() => SendCommand());
 | 
				
			||||||
            commandSent.ShouldBeTrue();   
 | 
					            commandSent.ShouldBeTrue();   
 | 
				
			||||||
@@ -248,6 +261,7 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                catch(Exception e)
 | 
					                catch(Exception e)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
					                    _output.WriteLine($"{e.Message}, {e.StackTrace}");
 | 
				
			||||||
                    Console.WriteLine(e);
 | 
					                    Console.WriteLine(e);
 | 
				
			||||||
                    return false;
 | 
					                    return false;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,17 +113,7 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
                })
 | 
					                })
 | 
				
			||||||
                .ConfigureServices(x =>
 | 
					                .ConfigureServices(x =>
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Action<ConfigurationBuilderCachePart> settings = (s) =>
 | 
					 | 
				
			||||||
                    {
 | 
					 | 
				
			||||||
                        s.WithMicrosoftLogging(log =>
 | 
					 | 
				
			||||||
                            {
 | 
					 | 
				
			||||||
                                log.AddConsole(LogLevel.Debug);
 | 
					 | 
				
			||||||
                            })
 | 
					 | 
				
			||||||
                            .WithDictionaryHandle();
 | 
					 | 
				
			||||||
                    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    x.AddOcelot()
 | 
					                    x.AddOcelot()
 | 
				
			||||||
                        .AddCacheManager(settings)
 | 
					 | 
				
			||||||
                        .AddAdministration("/administration", "secret");
 | 
					                        .AddAdministration("/administration", "secret");
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                .Configure(app =>
 | 
					                .Configure(app =>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user