Copilot commented on code in PR #2966:
URL: https://github.com/apache/hugegraph/pull/2966#discussion_r2958159664


##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/GraphSpaceApiStandaloneTest.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.api;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import jakarta.ws.rs.core.Response;
+
+/**
+ * Tests that GraphSpaceAPI returns a friendly HTTP 400 error in standalone
+ * mode (i.e. when the server is started without PD / hstore backend).
+ * <p>
+ * This class intentionally does NOT have a class-level Assume guard so that
+ * the tests are actually executed in non-hstore CI runs.
+ */
+public class GraphSpaceApiStandaloneTest extends BaseApiTest {
+
+    private static final String PATH = "graphspaces";
+    private static final String STANDALONE_ERROR =
+            "GraphSpace management is not supported in standalone mode";

Review Comment:
   `STANDALONE_ERROR` is duplicated here and in `ManagerApiStandaloneTest`. To 
avoid future drift if the server message changes, consider centralizing this 
string in a shared test constant (e.g., `BaseApiTest`) and referencing it from 
both standalone-mode test classes.
   



##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/ManagerApiStandaloneTest.java:
##########
@@ -0,0 +1,131 @@
+/*
+ * 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.api;
+
+import java.util.Map;
+
+import org.apache.hugegraph.auth.HugePermission;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import jakarta.ws.rs.core.Response;
+
+/**
+ * Tests that ManagerAPI returns a friendly HTTP 400 error in standalone mode
+ * (i.e. when the server is started without PD / hstore backend).
+ * <p>
+ * This class intentionally does NOT have a class-level Assume guard so that
+ * the tests are actually executed in non-hstore CI runs.
+ */
+public class ManagerApiStandaloneTest extends BaseApiTest {
+
+    private static final String STANDALONE_ERROR =
+            "GraphSpace management is not supported in standalone mode";
+

Review Comment:
   `STANDALONE_ERROR` is duplicated here and in `GraphSpaceApiStandaloneTest`. 
To avoid future drift if the server message changes, consider centralizing this 
string in a shared test constant (e.g., `BaseApiTest`) and referencing it from 
both standalone-mode test classes.



##########
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/api/BaseApiTest.java:
##########
@@ -748,6 +739,27 @@ public static RestClient analystClient(String graphSpace, 
String username) {
         return analystClient;
     }
 
+    /**
+     * Skips the current test if the server is running in hstore / PD mode.
+     * Treats both {@code "hstore"} and {@code null} (i.e. the property is not
+     * set, which is the default in hstore CI runs) as PD mode.
+     * Call this from a {@code @Before} method in standalone-only test classes.
+     */
+    public static void assumeStandaloneMode() {
+        String backend = System.getProperty("backend");
+        boolean isPdMode = backend == null || "hstore".equals(backend);
+        Assume.assumeFalse("Skip in PD/distributed mode", isPdMode);

Review Comment:
   The Javadoc and assumption message imply `backend == null` is effectively 
PD/hstore mode. In this test module, `backend` is generally expected to be 
explicitly set (and other tests treat null as its own “unset/invalid” case). 
Consider updating the Javadoc and the Assume message to reflect that null means 
“backend not provided/unknown” (and is skipped for safety), rather than 
specifically “default in hstore CI runs”.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to