mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 12:18:16 +08:00
Add ability to specify scheme of ServiceProviderConfiguration
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
private readonly string _serviceName;
|
||||
private readonly int _port;
|
||||
private readonly string _consulHost;
|
||||
private readonly string _consulScheme;
|
||||
private readonly string _fakeConsulServiceDiscoveryUrl;
|
||||
private List<Service> _services;
|
||||
private readonly Mock<IOcelotLoggerFactory> _factory;
|
||||
@ -37,6 +38,7 @@
|
||||
_serviceName = "test";
|
||||
_port = 8500;
|
||||
_consulHost = "localhost";
|
||||
_consulScheme = "https";
|
||||
_fakeConsulServiceDiscoveryUrl = $"http://{_consulHost}:{_port}";
|
||||
_serviceEntries = new List<ServiceEntry>();
|
||||
_factory = new Mock<IOcelotLoggerFactory>();
|
||||
@ -44,7 +46,7 @@
|
||||
_logger = new Mock<IOcelotLogger>();
|
||||
_factory.Setup(x => x.CreateLogger<Consul>()).Returns(_logger.Object);
|
||||
_factory.Setup(x => x.CreateLogger<PollConsul>()).Returns(_logger.Object);
|
||||
var config = new ConsulRegistryConfiguration(_consulHost, _port, _serviceName, null);
|
||||
var config = new ConsulRegistryConfiguration(_consulScheme, _consulHost, _port, _serviceName, null);
|
||||
_provider = new Consul(config, _factory.Object, _clientFactory);
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@
|
||||
public void should_use_token()
|
||||
{
|
||||
var token = "test token";
|
||||
var config = new ConsulRegistryConfiguration(_consulHost, _port, _serviceName, token);
|
||||
var config = new ConsulRegistryConfiguration(_consulScheme, _consulHost, _port, _serviceName, token);
|
||||
_provider = new Consul(config, _factory.Object, _clientFactory);
|
||||
|
||||
var serviceEntryOne = new ServiceEntry()
|
||||
|
Reference in New Issue
Block a user