This is an automated email from the ASF dual-hosted git repository. imbajin pushed a commit to branch cdx/hubble-monitoring-pd-secret-redaction in repository https://gitbox.apache.org/repos/asf/hugegraph.git
commit 87fcddc61d6c99cc59c3cd34e0f8022e1aa001b5 Author: imbajin <[email protected]> AuthorDate: Sun Jul 19 17:05:23 2026 +0800 fix(pd): restore reactor test compilation - call Store REST address utility directly from discovery - remove the service test hidden by the repackaged jar - retain Store address validation in the existing utility suite --- .../hugegraph/pd/service/SDConfigService.java | 6 +-- .../apache/hugegraph/pd/rest/PDRestSuiteTest.java | 2 - .../hugegraph/pd/service/SDConfigServiceTest.java | 48 ---------------------- 3 files changed, 1 insertion(+), 55 deletions(-) diff --git a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/SDConfigService.java b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/SDConfigService.java index d627d5402..a5d7cc125 100644 --- a/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/SDConfigService.java +++ b/hugegraph-pd/hg-pd-service/src/main/java/org/apache/hugegraph/pd/service/SDConfigService.java @@ -206,7 +206,7 @@ public class SDConfigService { } if (stores != null) { stores.stream().forEach(e -> { - String buf = getRestAddress(e); + String buf = StoreRestAddressUtil.getRestAddress(e); if (buf != null) { res.add(buf); } @@ -215,10 +215,6 @@ public class SDConfigService { return res; } - static String getRestAddress(Metapb.Store store) { - return StoreRestAddressUtil.getRestAddress(store); - } - public List<SDConfig> getConfigs(String appName, String path) { HgAssert.isArgumentNotNull(appName, "appName"); SDConfig config; diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/PDRestSuiteTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/PDRestSuiteTest.java index 38646b4d9..5dba56194 100644 --- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/PDRestSuiteTest.java +++ b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/rest/PDRestSuiteTest.java @@ -17,7 +17,6 @@ package org.apache.hugegraph.pd.rest; -import org.apache.hugegraph.pd.service.SDConfigServiceTest; import org.apache.hugegraph.pd.util.StoreRestAddressUtilTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -27,7 +26,6 @@ import lombok.extern.slf4j.Slf4j; @RunWith(Suite.class) @Suite.SuiteClasses({ RestApiTest.class, - SDConfigServiceTest.class, StoreRestAddressUtilTest.class, }) @Slf4j diff --git a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/SDConfigServiceTest.java b/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/SDConfigServiceTest.java deleted file mode 100644 index 73e61295a..000000000 --- a/hugegraph-pd/hg-pd-test/src/main/java/org/apache/hugegraph/pd/service/SDConfigServiceTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hugegraph.pd.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.apache.hugegraph.pd.grpc.Metapb; -import org.junit.Test; - -public class SDConfigServiceTest { - - @Test - public void testStoreDiscoveryRequiresValidRestPort() { - assertNull(SDConfigService.getRestAddress( - store("127.0.0.1:8500", null))); - assertNull(SDConfigService.getRestAddress( - store("127.0.0.1:8500", "invalid"))); - assertEquals("127.0.0.1:8520", SDConfigService.getRestAddress( - store("127.0.0.1:8500", "8520"))); - } - - private static Metapb.Store store(String address, String restPort) { - Metapb.Store.Builder builder = Metapb.Store.newBuilder() - .setAddress(address); - if (restPort != null) { - builder.addLabels(Metapb.StoreLabel.newBuilder() - .setKey("rest.port") - .setValue(restPort)); - } - return builder.build(); - } -}
