From aa813a9c0f640bef914533f5391819b62ea297f5 Mon Sep 17 00:00:00 2001 From: Zachary Pinto Date: Fri, 27 Oct 2023 13:39:50 -0400 Subject: [PATCH] Fix testGetDomainInformation since we no longer allow an instance to join the cluster with an invalid DOMAIN field. --- .../helix/manager/zk/TestZkHelixAdmin.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java index e1ffbb646c..59decd98e5 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java @@ -898,24 +898,28 @@ public void testGetDomainInformation() { InstanceConfig instanceConfig = new InstanceConfig(instanceName); instanceConfig.setHostName(hostname); instanceConfig.setPort(port); - if (i == 40) { - instanceConfig.setDomain(String - .format("invaliddomain=%s,zone=%s,rack=%s,host=%s", "mygroup" + i % 2, "myzone" + i % 4, - "myrack" + i % 4, hostname)); - } else if (i == 41) { - instanceConfig.setDomain("invaliddomain"); - } else { - String domain = String - .format("group=%s,zone=%s,rack=%s,host=%s", "mygroup" + i % 2, "myzone" + i % 4, - "myrack" + i % 4, hostname); - instanceConfig.setDomain(domain); - } + + String domain = + String.format("group=%s,zone=%s,rack=%s,host=%s", "mygroup" + i % 2, "myzone" + i % 4, + "myrack" + i % 4, hostname); + instanceConfig.setDomain(domain); + LiveInstance liveInstance = new LiveInstance(instanceName); liveInstance.setSessionId(UUID.randomUUID().toString()); liveInstance.setHelixVersion(UUID.randomUUID().toString()); accessor.setProperty(keyBuilder.liveInstance(instanceName), liveInstance); admin.addInstance(clusterName, instanceConfig); admin.enableInstance(clusterName, instanceName, true); + + if (i == 40) { + instanceConfig.setDomain( + String.format("invaliddomain=%s,zone=%s,rack=%s,host=%s", "mygroup" + i % 2, + "myzone" + i % 4, "myrack" + i % 4, hostname)); + admin.setInstanceConfig(clusterName, instanceName, instanceConfig); + } else if (i == 41) { + instanceConfig.setDomain("invaliddomain"); + admin.setInstanceConfig(clusterName, instanceName, instanceConfig); + } } ClusterTopology clusterTopology = admin.getClusterTopology(clusterName);