Skip to content

Commit

Permalink
Fix a failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
nisargthakkar committed Jul 25, 2024
1 parent 8d77d17 commit 32f69a6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,17 @@ public void testSanitizingStringForLogger() {
public void testParseCommaSeparatedStringToSet() {
Assert.assertTrue(Utils.parseCommaSeparatedStringToSet(null).isEmpty());
Assert.assertTrue(Utils.parseCommaSeparatedStringToSet("").isEmpty());

Set<String> set = Utils.parseCommaSeparatedStringToSet("a,b,c");
Assert.assertEquals(set.size(), 3);
Assert.assertTrue(set.contains("a"));
Assert.assertTrue(set.contains("b"));
Assert.assertTrue(set.contains("c"));

Set<String> setWithSpaces = Utils.parseCommaSeparatedStringToSet("a, b, c");
Assert.assertEquals(setWithSpaces.size(), 3);
Assert.assertTrue(setWithSpaces.contains("a"));
Assert.assertTrue(setWithSpaces.contains("b"));
Assert.assertTrue(setWithSpaces.contains("c"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -707,13 +707,14 @@ public VeniceControllerClusterConfig(VeniceProperties props) {
activeActiveRealTimeSourceFabrics = nativeReplicationSourceFabricAllowlist;
}

for (String aaSourceFabric: activeActiveRealTimeSourceFabrics) {
if (!childDataCenterKafkaUrlMap.containsKey(aaSourceFabric)) {
throw new VeniceException(String.format("No Kafka URL found for A/A source fabric '%s'", aaSourceFabric));
}
}

this.activeActiveRealTimeSourceKafkaURLs = activeActiveRealTimeSourceFabrics.stream()
.map(childDataCenterKafkaUrlMap::get) // Get the Kafka URL for each fabric
.peek(kafkaUrl -> { // Ensure that a Kafka URL is found for each fabric
if (kafkaUrl == null) {
throw new VeniceException("No Kafka URL found for A/A source fabric");
}
})
.map(childDataCenterKafkaUrlMap::get)
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));

this.nativeReplicationSourceFabric = props.getString(NATIVE_REPLICATION_SOURCE_FABRIC, "");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.linkedin.venice.controller;

import static com.linkedin.venice.ConfigKeys.ACTIVE_ACTIVE_REAL_TIME_SOURCE_FABRIC_LIST;
import static com.linkedin.venice.ConfigKeys.ADMIN_HELIX_MESSAGING_CHANNEL_ENABLED;
import static com.linkedin.venice.ConfigKeys.CHILD_CLUSTER_ALLOWLIST;
import static com.linkedin.venice.ConfigKeys.CHILD_CLUSTER_URL_PREFIX;
Expand Down Expand Up @@ -141,6 +142,7 @@ private Properties getBaseMultiRegionProperties(boolean includeMultiRegionConfig
props.put(NATIVE_REPLICATION_FABRIC_ALLOWLIST, "dc-0, dc-1, dc-parent");
props.put(CHILD_DATA_CENTER_KAFKA_URL_PREFIX + ".dc-0", "kafkaUrlDc0");
props.put(CHILD_DATA_CENTER_KAFKA_URL_PREFIX + ".dc-1", "kafkaUrlDc1");
props.put(CHILD_DATA_CENTER_KAFKA_URL_PREFIX + ".dc-parent", "kafkaUrlDcParent");

if (includeMultiRegionConfig) {
props.put(MULTI_REGION, "true");
Expand Down Expand Up @@ -169,6 +171,12 @@ public void testMultiRegionConfig(boolean explicitMultiRegionConfig) {
new VeniceControllerClusterConfig(new VeniceProperties(multiRegionProps));
Assert.assertTrue(multiRegionConfig.isMultiRegion());

Properties multiRegionPropsWithAaSourceRegion = getBaseMultiRegionProperties(explicitMultiRegionConfig);
multiRegionPropsWithAaSourceRegion.put(ACTIVE_ACTIVE_REAL_TIME_SOURCE_FABRIC_LIST, "dc-0, dc-1");
VeniceControllerClusterConfig multiRegionConfigWithAaSourceRegion =
new VeniceControllerClusterConfig(new VeniceProperties(multiRegionPropsWithAaSourceRegion));
Assert.assertTrue(multiRegionConfigWithAaSourceRegion.isMultiRegion());

Properties parentControllerProps = getBaseParentControllerProperties(explicitMultiRegionConfig);
VeniceControllerClusterConfig parentControllerConfig =
new VeniceControllerClusterConfig(new VeniceProperties(parentControllerProps));
Expand Down

0 comments on commit 32f69a6

Please sign in to comment.