World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#10035] fix(mcp-server): Use a concrete version of `fastmcp` to avoid CI error as 3.0.x makes breaking changes (#10036)
Qi Yue7160ea80e55
diff --git a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/ITUtils.java b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/ITUtils.javaindex e9dbe940da..70862e4de8 100644--- a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/ITUtils.java+++ b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/ITUtils.java@@ -51,6 +51,8 @@ import org.slf4j.LoggerFactory;public class ITUtils {private static final Logger LOG = LoggerFactory.getLogger(ITUtils.class);+ private static final String CI_ENV = "CI";+ private static final String GITHUB_ACTIONS_ENV = "GITHUB_ACTIONS";public static final String TEST_MODE = "testMode";public static final String EMBEDDED_TEST_MODE = "embedded";@@ -210,6 +212,10 @@ public class ITUtils {}public static void cleanDisk() {+ if (!isCiEnvironment(System.getenv())) {+ LOG.info("Skip disk cleanup because current environment is not CI.");+ return;+ }Object output =CommandExecutor.executeCommandLocalHost(@@ -220,8 +226,9 @@ public class ITUtils {"free -m", false, ProcessData.TypesOfData.STREAMS_MERGED, Map.of());LOG.info("Before clean: Command free -m output:\n{}", output);- // Execute docker system prune -af to free up space before starting the OceanBase container- ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "docker system prune -f");+ // Execute docker container prune -f to clean only stopped containers in CI.+ ProcessBuilder processBuilder =+ new ProcessBuilder("/bin/bash", "-c", "docker container prune -f");try {Process process = processBuilder.start();int exitCode = process.waitFor();@@ -245,5 +252,10 @@ public class ITUtils {LOG.info("After clean: Command free -m output:\n{}", output);}+ static boolean isCiEnvironment(Map<String, String> env) {+ return "true".equalsIgnoreCase(env.get(CI_ENV))+ || "true".equalsIgnoreCase(env.get(GITHUB_ACTIONS_ENV));+ }+private ITUtils() {}}diff --git a/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/TestITUtils.java b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/TestITUtils.javanew file mode 100644index 0000000000..cb07597989--- /dev/null+++ b/integration-test-common/src/test/java/org/apache/gravitino/integration/test/util/TestITUtils.java@@ -0,0 +1,46 @@+/*+ * 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.gravitino.integration.test.util;++import java.util.Map;+import org.junit.jupiter.api.Assertions;+import org.junit.jupiter.api.Test;++public class TestITUtils {+ @Test+ public void testIsCiEnvironmentByCI() {+ Assertions.assertTrue(ITUtils.isCiEnvironment(Map.of("CI", "true")));+ }++ @Test+ public void testIsCiEnvironmentByGitHubActions() {+ Assertions.assertTrue(ITUtils.isCiEnvironment(Map.of("GITHUB_ACTIONS", "true")));+ }++ @Test+ public void testIsCiEnvironmentCaseInsensitive() {+ Assertions.assertTrue(ITUtils.isCiEnvironment(Map.of("CI", "TRUE")));+ }++ @Test+ public void testIsCiEnvironmentFalse() {+ Assertions.assertFalse(ITUtils.isCiEnvironment(Map.of()));+ Assertions.assertFalse(ITUtils.isCiEnvironment(Map.of("CI", "false")));+ }+}diff --git a/mcp-server/pyproject.toml b/mcp-server/pyproject.tomlindex 99e0903d94..6c24c8c070 100644--- a/mcp-server/pyproject.toml+++ b/mcp-server/pyproject.toml@@ -22,7 +22,9 @@ description = "Gravitino MCP server"readme = "README.md"requires-python = ">=3.10"dependencies = [- "fastmcp>=2.10.6",+ # fastmcp has been release 3.0.x, which makes some incompatible changes, so we temporarily pin+ # it to 2.14.5 to avoid breaking changes.+ "fastmcp==2.14.5","parameterized>=0.9.0","pytest>=8.4.1","pylint>=2.20.0",