Merge branch '2.0.x'
This commit is contained in:
@@ -53,7 +53,7 @@ public class ConsulDiscoveryProperties {
|
||||
private boolean enabled = true;
|
||||
|
||||
/** Tags to use when registering management service */
|
||||
private List<String> managementTags = Arrays.asList(MANAGEMENT);
|
||||
private List<String> managementTags = new ArrayList<>();
|
||||
|
||||
/** Alternate server path to invoke for health checking */
|
||||
private String healthCheckPath = "/actuator/health";
|
||||
@@ -175,9 +175,12 @@ public class ConsulDiscoveryProperties {
|
||||
private int order = 0;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private ConsulDiscoveryProperties() {}
|
||||
private ConsulDiscoveryProperties() {
|
||||
this.managementTags.add(MANAGEMENT);
|
||||
}
|
||||
|
||||
public ConsulDiscoveryProperties(InetUtils inetUtils) {
|
||||
this();
|
||||
this.hostInfo = inetUtils.findFirstNonLoopbackHostInfo();
|
||||
this.ipAddress = this.hostInfo.getIpAddress();
|
||||
this.hostname = this.hostInfo.getHostname();
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
package org.springframework.cloud.consul.discovery;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.cloud.commons.util.InetUtils;
|
||||
import org.springframework.cloud.commons.util.InetUtilsProperties;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.cloud.commons.util.InetUtils;
|
||||
import org.springframework.cloud.commons.util.InetUtilsProperties;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@@ -56,4 +58,11 @@ public class ConsulDiscoveryPropertiesTests {
|
||||
public void testGetDcReturnsMapValueWhenInMap() {
|
||||
assertEquals(MAP_DC, properties.getDatacenters().get(SERVICE_NAME_IN_MAP));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddManagementTag() {
|
||||
properties.getManagementTags().add("newTag");
|
||||
assertThat(properties.getManagementTags())
|
||||
.containsOnly(ConsulDiscoveryProperties.MANAGEMENT, "newTag");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user