예제 #1
0
        public void UpdateConfigurationUsesDefaultsWhenNoUrl()
        {
            var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary <string, string>()
            {
            }).Build();
            var instOpts = new EurekaInstanceOptions();

            instOpts.ApplyConfigUrls(config.GetAspNetCoreUrls(), ConfigurationUrlHelpers.WILDCARD_HOST);

            Assert.Equal(80, instOpts.Port);
            Assert.False(instOpts.SecurePortEnabled);
            Assert.True(instOpts.NonSecurePortEnabled);
        }
예제 #2
0
        public void UpdateConfigurationHandlesPlus()
        {
            var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary <string, string>()
            {
                { "urls", "https://+:443;http://+:80" }
            }).Build();
            var instOpts = new EurekaInstanceOptions();

            instOpts.ApplyConfigUrls(config.GetAspNetCoreUrls(), ConfigurationUrlHelpers.WILDCARD_HOST);

            Assert.Equal(80, instOpts.Port);
            Assert.Equal(443, instOpts.SecurePort);
            Assert.True(instOpts.SecurePortEnabled);
            Assert.False(instOpts.NonSecurePortEnabled);
        }
예제 #3
0
        public void UpdateConfigurationFindsHttpUrl()
        {
            var config = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary <string, string>()
            {
                { "urls", "http://myapp:1233" }
            }).Build();
            var instOpts = new EurekaInstanceOptions();

            instOpts.ApplyConfigUrls(config.GetAspNetCoreUrls(), ConfigurationUrlHelpers.WILDCARD_HOST);

            Assert.Equal("myapp", instOpts.HostName);
            Assert.Equal(1233, instOpts.Port);
            Assert.False(instOpts.SecurePortEnabled);
            Assert.True(instOpts.NonSecurePortEnabled);
        }