Add test to make sure eureka.instance.*virtualHostName can be set properly.

parent 9125f548
...@@ -181,7 +181,7 @@ public class EurekaInstanceConfigBeanTests { ...@@ -181,7 +181,7 @@ public class EurekaInstanceConfigBeanTests {
} }
@Test @Test
public void testVirtualHostName() throws Exception { public void testDefaultVirtualHostName() throws Exception {
addEnvironment(this.context, "spring.application.name:myapp"); addEnvironment(this.context, "spring.application.name:myapp");
setupContext(); setupContext();
assertEquals("virtualHostName wrong", "myapp", getInstanceConfig().getVirtualHostName()); assertEquals("virtualHostName wrong", "myapp", getInstanceConfig().getVirtualHostName());
...@@ -190,6 +190,16 @@ public class EurekaInstanceConfigBeanTests { ...@@ -190,6 +190,16 @@ public class EurekaInstanceConfigBeanTests {
} }
@Test @Test
public void testCustomVirtualHostName() throws Exception {
addEnvironment(this.context, "spring.application.name:myapp", "eureka.instance.virtualHostName=myvirthost",
"eureka.instance.secureVirtualHostName=mysecurevirthost");
setupContext();
assertEquals("virtualHostName wrong", "myvirthost", getInstanceConfig().getVirtualHostName());
assertEquals("secureVirtualHostName wrong", "mysecurevirthost", getInstanceConfig().getSecureVirtualHostName());
}
@Test
public void testDefaultAppName() throws Exception { public void testDefaultAppName() throws Exception {
setupContext(); setupContext();
assertEquals("default app name is wrong", "unknown", getInstanceConfig().getAppname()); assertEquals("default app name is wrong", "unknown", getInstanceConfig().getAppname());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment