Commit bab74edf by Spencer Gibb

Merge pull request #340 from kaczynskid/master

Corrected example of providing Turbine cluster name via instance metadata map
parents 652e4b96 8fa9b715
......@@ -477,7 +477,7 @@ turbine:
aggregator:
clusterConfig: SYSTEM,USER
appConfig: customers,stores,ui,admin
clusterNameExpression: metadata.cluster
clusterNameExpression: metadata['cluster']
----
In this case, the cluster name from 4 services is pulled from their metadata map, and is expected to have values that include "SYSTEM" and "USER".
......
......@@ -50,4 +50,16 @@ public class EurekaInstanceDiscoveryTest {
assertEquals("clusterName is wrong", asgName, clusterName);
}
@Test
public void testGetClusterNameInstanceMetadataMapExpression() {
TurbineProperties turbineProperties = new TurbineProperties();
turbineProperties.setClusterNameExpression("metadata['cluster']");
EurekaInstanceDiscovery discovery = new EurekaInstanceDiscovery(turbineProperties);
String metadataProperty = "myCluster";
InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder()
.setAppName("testApp").add("cluster", metadataProperty).build();
String clusterName = discovery.getClusterName(instanceInfo);
assertEquals("clusterName is wrong", metadataProperty, clusterName);
}
}
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