mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 10:08:14 +08:00
Remove Ocelot specific Middleware to make Ocelot more compatible with kestrel middleware and get ready for YARP
This commit is contained in:
@ -17,12 +17,11 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
private readonly RoundRobin _roundRobin;
|
||||
private readonly List<Service> _services;
|
||||
private Response<ServiceHostAndPort> _hostAndPort;
|
||||
private DownstreamContext _context;
|
||||
private HttpContext _httpContext;
|
||||
|
||||
public RoundRobinTests()
|
||||
{
|
||||
_context = new DownstreamContext(new DefaultHttpContext());
|
||||
|
||||
_httpContext = new DefaultHttpContext();
|
||||
_services = new List<Service>
|
||||
{
|
||||
new Service("product", new ServiceHostAndPort("127.0.0.1", 5000), string.Empty, string.Empty, new string[0]),
|
||||
@ -52,18 +51,18 @@ namespace Ocelot.UnitTests.LoadBalancer
|
||||
|
||||
while (stopWatch.ElapsedMilliseconds < 1000)
|
||||
{
|
||||
var address = _roundRobin.Lease(_context).Result;
|
||||
var address = _roundRobin.Lease(_httpContext).Result;
|
||||
address.Data.ShouldBe(_services[0].HostAndPort);
|
||||
address = _roundRobin.Lease(_context).Result;
|
||||
address = _roundRobin.Lease(_httpContext).Result;
|
||||
address.Data.ShouldBe(_services[1].HostAndPort);
|
||||
address = _roundRobin.Lease(_context).Result;
|
||||
address = _roundRobin.Lease(_httpContext).Result;
|
||||
address.Data.ShouldBe(_services[2].HostAndPort);
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenIGetTheNextAddress()
|
||||
{
|
||||
_hostAndPort = _roundRobin.Lease(_context).Result;
|
||||
_hostAndPort = _roundRobin.Lease(_httpContext).Result;
|
||||
}
|
||||
|
||||
private void ThenTheNextAddressIndexIs(int index)
|
||||
|
Reference in New Issue
Block a user