protected override IGatewayListProvider CreateGatewayListProvider(ILogger logger)
        {
            ConsulTestUtils.EnsureConsul();
            var options = new ConsulClusteringOptions();
            var address = new Uri(this.connectionString);

            options.ConfigureConsulClient(address);

            return(new ConsulGatewayListProvider(loggerFactory.CreateLogger <ConsulGatewayListProvider>(), Options.Create(options), this.gatewayOptions, this.clusterOptions));
        }
        protected override IMembershipTable CreateMembershipTable(ILogger logger)
        {
            ConsulTestUtils.EnsureConsul();
            var options = new ConsulClusteringOptions();
            var address = new Uri(this.connectionString);

            options.ConfigureConsulClient(address);

            return(new ConsulBasedMembershipTable(loggerFactory.CreateLogger <ConsulBasedMembershipTable>(), Options.Create(options), this.clusterOptions));
        }
Beispiel #3
0
        public void ThrowsArgumentNullExceptionIfCallbackIsNull()
        {
            var options = new ConsulClusteringOptions();
            Func <IConsulClient> callback = null;

            // ensure we check the callback.
            var shouldThrow = () => options.ConfigureConsulClient(callback);

            Assert.Throws <ArgumentNullException>(shouldThrow);
        }
Beispiel #4
0
        public void WeCanUseConfigureToSetupTheDefaultClientWithoutAAclToken()
        {
            var address = new Uri("http://localhost:8501");
            var options = new ConsulClusteringOptions();

            //we can configure the default consult client
            options.ConfigureConsulClient(address);

            var client = (ConsulClient)options.CreateClient();

            Assert.Equal(address, client.Config.Address);
            Assert.Null(client.Config.Token);
        }
Beispiel #5
0
        public void WeCanInjectAConsulClient()
        {
            var fakeConsul = new FakeConsul();
            var options    = new ConsulClusteringOptions();
            Func <IConsulClient> callback = () => fakeConsul;

            //we can inject the consul
            options.ConfigureConsulClient(callback);

            var actual = options.CreateClient();

            Assert.Equal(fakeConsul, actual);
        }