This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new d896d2e69 Remove cloud config check in VirtualTopologyGroupService
(#2190)
d896d2e69 is described below
commit d896d2e690582d464da872706d5e7eb092d34f22
Author: Qi (Quincy) Qu <[email protected]>
AuthorDate: Mon Aug 15 09:59:03 2022 -0700
Remove cloud config check in VirtualTopologyGroupService (#2190)
Remove the dependency on CloudConfig for setting virtual topology group.
---
.../rest/server/service/VirtualTopologyGroupService.java | 5 -----
.../server/service/TestVirtualTopologyGroupService.java | 15 ++++-----------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git
a/helix-rest/src/main/java/org/apache/helix/rest/server/service/VirtualTopologyGroupService.java
b/helix-rest/src/main/java/org/apache/helix/rest/server/service/VirtualTopologyGroupService.java
index 997b88035..2fd5f2824 100644
---
a/helix-rest/src/main/java/org/apache/helix/rest/server/service/VirtualTopologyGroupService.java
+++
b/helix-rest/src/main/java/org/apache/helix/rest/server/service/VirtualTopologyGroupService.java
@@ -89,11 +89,6 @@ public class VirtualTopologyGroupService {
*/
public void addVirtualTopologyGroup(String clusterName, Map<String, String>
customFields) {
// validation
- CloudConfig cloudConfig = _configAccessor.getCloudConfig(clusterName);
- if (cloudConfig == null || !cloudConfig.isCloudEnabled()) {
- throw new HelixException(
- "Cloud is not enabled, addVirtualTopologyGroup is not allowed to run
in non-cloud environment.");
- }
ClusterConfig clusterConfig =
_configAccessor.getClusterConfig(clusterName);
Preconditions.checkState(clusterConfig.isTopologyAwareEnabled(),
"Topology-aware rebalance is not enabled in cluster " + clusterName);
diff --git
a/helix-rest/src/test/java/org/apache/helix/rest/server/service/TestVirtualTopologyGroupService.java
b/helix-rest/src/test/java/org/apache/helix/rest/server/service/TestVirtualTopologyGroupService.java
index ab1c53fa4..3ffc29c74 100644
---
a/helix-rest/src/test/java/org/apache/helix/rest/server/service/TestVirtualTopologyGroupService.java
+++
b/helix-rest/src/test/java/org/apache/helix/rest/server/service/TestVirtualTopologyGroupService.java
@@ -83,13 +83,6 @@ public class TestVirtualTopologyGroupService {
clusterConfig.setTopologyAwareEnabled(true);
when(_configAccessor.getClusterConfig(TEST_CLUSTER0)).thenReturn(clusterConfig);
- CloudConfig.Builder cloudConfigBuilder = new CloudConfig.Builder();
- cloudConfigBuilder.setCloudEnabled(true);
- cloudConfigBuilder.setCloudProvider(CloudProvider.AZURE);
- cloudConfigBuilder.setCloudID("TestID");
- CloudConfig cloudConfig = cloudConfigBuilder.build();
-
when(_configAccessor.getCloudConfig(TEST_CLUSTER0)).thenReturn(cloudConfig);
-
_helixAdmin = mock(HelixAdmin.class);
when(_helixAdmin.isInMaintenanceMode(anyString())).thenReturn(true);
@@ -101,10 +94,10 @@ public class TestVirtualTopologyGroupService {
_service = new VirtualTopologyGroupService(_helixAdmin, clusterService,
_configAccessor, _dataAccessor);
}
- @Test(expectedExceptions = HelixException.class,
expectedExceptionsMessageRegExp = "Cloud is not enabled.*")
- public void testClusterCloudConfigSetup() {
- ClusterConfig clusterConfig1 = new ClusterConfig(TEST_CLUSTER1);
-
when(_configAccessor.getClusterConfig(TEST_CLUSTER1)).thenReturn(clusterConfig1);
+ @Test(expectedExceptions = IllegalStateException.class,
+ expectedExceptionsMessageRegExp = "Topology-aware rebalance is not
enabled.*")
+ public void testTopologyAwareEnabledSetup() {
+ when(_configAccessor.getClusterConfig(TEST_CLUSTER1)).thenReturn(new
ClusterConfig(TEST_CLUSTER1));
_service.addVirtualTopologyGroup(TEST_CLUSTER1,
ImmutableMap.of(GROUP_NAME, "test-group", GROUP_NUMBER, "2"));
}