You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by yx...@apache.org on 2025/07/22 07:54:41 UTC

(shardingsphere) branch master updated: Change the execution phase of NativeTest under GraalVM Native Image from `test` to `integration-test` (#36050)

This is an automated email from the ASF dual-hosted git repository.

yx9o pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d05e74a3e7 Change the execution phase of NativeTest under GraalVM Native Image from `test` to `integration-test` (#36050)
2d05e74a3e7 is described below

commit 2d05e74a3e730c686c9c53d680db0cf69bafd493
Author: Ling Hengqian <li...@outlook.com>
AuthorDate: Tue Jul 22 15:54:34 2025 +0800

    Change the execution phase of NativeTest under GraalVM Native Image from `test` to `integration-test` (#36050)
---
 .../graalvm-native-image/_index.cn.md              |  2 +-
 .../graalvm-native-image/_index.en.md              |  2 +-
 .../graalvm-native-image/development/_index.cn.md  | 11 +++-
 .../graalvm-native-image/development/_index.en.md  | 11 +++-
 .../reachability-metadata.json                     | 18 ------
 .../reachability-metadata.json                     |  7 ++
 pom.xml                                            | 75 ++++++++++++++--------
 .../reachability-metadata.json                     | 22 ++-----
 8 files changed, 77 insertions(+), 71 deletions(-)

diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
index 7201234f3cd..61bccaa3e7b 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.cn.md
@@ -17,7 +17,7 @@ ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建
 
 - GraalVM CE For JDK 24.0.2,对应于 SDKMAN! 的 `24.0.2-graalce`
 
-用户依然可以使用 SDKMAN! 上的 `21.0.8-graal` 等旧版本的 GraalVM CE 来构建 ShardingSphere 的 GraalVM Native Image 产物。
+用户依然可以使用 SDKMAN! 上的 `21.0.8-graal` 等旧版本的 Oracle GraalVM 来构建 ShardingSphere 的 GraalVM Native Image 产物。
 但这将导致集成部分第三方依赖时,构建 GraalVM Native Image 失败。
 分类讨论,
 
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
index 51b9648c545..e6b796dd66e 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/_index.en.md
@@ -18,7 +18,7 @@ https://sdkman.io/jdks#nik and https://sdkman.io/jdks#mandrel .
 
 - GraalVM CE For JDK 24.0.2, corresponding to `24.0.2-graalce` of SDKMAN!
 
-Users can still use old versions of GraalVM CE such as `21.0.8-graal` on SDKMAN! to build ShardingSphere's GraalVM Native Image product.
+Users can still use old versions of Oracle GraalVM such as `21.0.8-graal` on SDKMAN! to build ShardingSphere's GraalVM Native Image product.
 But this will cause the failure of building GraalVM Native Image when integrating some third-party dependencies.
 Classification discussion,
 1. Developers are using `org.apache.hive:hive-jdbc:4.0.1` related to HiveServer2 JDBC Driver. Since HiveServer2 JDBC Driver uses AWT-related classes,
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.cn.md
index 4bb886cdbe9..af8091f202b 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.cn.md
@@ -112,6 +112,11 @@ wsl --install
 ### Windows Server
 
 对于通常的 Windows Server 2025 实例,操作等同于 Windows 11 Home 24H2。
+但受 https://github.com/rancher-sandbox/rancher-desktop/issues/3999 影响,
+如果开发者正在使用的 Windows Server 2025 实例包含可运行 Windows Containers 的 Docker Engine,
+则需要根据 https://github.com/microsoft/Windows-Containers/pull/602 的内容来完全卸载 Docker Engine,
+再安装 Rancher Desktop。
+这类操作常见于 `windows-2025` 的 GitHub Actions Runner 中。
 
 ## 处理单元测试
 
@@ -122,7 +127,7 @@ wsl --install
 ```shell
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -e -T 1C clean test
+./mvnw -PgenerateMetadata -e -T 1C clean verify
 ```
 
 ### 在 GraalVM Native Image 下执行单元测试
@@ -132,7 +137,7 @@ cd ./shardingsphere/
 ```bash
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PnativeTestInShardingSphere -e -T 1C clean test
+./mvnw -PnativeTestInShardingSphere -e -T 1C clean verify
 ```
 
 当 Windows 弹出窗口,要求允许类似 `C:\users\shard\shardingsphere\test\native\target\native-tests.exe.exe` 路径的应用通过 Windows 防火墙时,应当批准。
@@ -153,7 +158,7 @@ cd ./shardingsphere/
 ```bash
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -e -T 1C clean test native:metadata-copy
+./mvnw -PgenerateMetadata -e -T 1C clean verify native:metadata-copy
 ```
 
 贡献者仍可能需要手动调整具体的 JSON 条目,并适时调整 Maven Profile 和 GraalVM Tracing Agent 的 Filter 链。
diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.en.md
index d0acd48f2dc..ddbb5b57ae7 100644
--- a/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.en.md
+++ b/docs/document/content/user-manual/shardingsphere-jdbc/graalvm-native-image/development/_index.en.md
@@ -119,6 +119,11 @@ This article does not discuss changing the default logging driver in `/etc/docke
 ### Windows Server
 
 For a regular Windows Server 2025 instance, the operation is equivalent to Windows 11 Home 24H2.
+However, affected by https://github.com/rancher-sandbox/rancher-desktop/issues/3999 ,
+if the Windows Server 2025 instance that the developer is using contains Docker Engine that can run Windows Containers,
+it is necessary to completely uninstall Docker Engine according to the content of https://github.com/microsoft/Windows-Containers/pull/602 ,
+and then install Rancher Desktop.
+This type of operation is common in the GitHub Actions Runner of `windows-2025`.
 
 ## Handling unit tests
 
@@ -130,7 +135,7 @@ that is, avoid compiling GraalVM Native Image, developer can execute the followi
 ```shell
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -e -T 1C clean test
+./mvnw -PgenerateMetadata -e -T 1C clean verify
 ```
 
 ### Execute unit tests under GraalVM Native Image
@@ -140,7 +145,7 @@ Developer can use the following commands to compile the GraalVM Native Image req
 ```shell
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PnativeTestInShardingSphere -e -T 1C clean test
+./mvnw -PnativeTestInShardingSphere -e -T 1C clean verify
 ```
 
 When Windows pops up a window asking developer to allow an app with a path like `C:\users\shard\shardingsphere\test\native\target\native-tests.exe.exe` to pass through Windows Firewall, 
@@ -162,7 +167,7 @@ This process can be easily handled by the following command.
 ```bash
 git clone git@github.com:apache/shardingsphere.git
 cd ./shardingsphere/
-./mvnw -PgenerateMetadata -e -T 1C clean test native:metadata-copy
+./mvnw -PgenerateMetadata -e -T 1C clean verify native:metadata-copy
 ```
 
 Developer may still need to manually adjust specific JSON entries and adjust the filter chain of Maven Profile and GraalVM Tracing Agent as appropriate.
diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
index 7fedd9d9a10..a91f1e89017 100644
--- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
+++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json
@@ -9185,18 +9185,6 @@
       },
       "type": "org.apache.shardingsphere.sharding.auditor.ShardingSQLAuditor"
     },
-    {
-      "condition": {
-        "typeReached": "org.apache.shardingsphere.sharding.checker.sql.dml.ShardingTableSupportedChecker"
-      },
-      "type": "org.apache.shardingsphere.sharding.check.mysql.MySQLUnsupportedShardingSQLStatementProvider"
-    },
-    {
-      "condition": {
-        "typeReached": "org.apache.shardingsphere.sharding.checker.sql.dml.ShardingTableSupportedChecker"
-      },
-      "type": "org.apache.shardingsphere.sharding.check.postgresql.PostgreSQLUnsupportedShardingSQLStatementProvider"
-    },
     {
       "condition": {
         "typeReached": "org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader"
@@ -13143,12 +13131,6 @@
       },
       "glob": "META-INF/services/org.apache.shardingsphere.readwritesplitting.route.standard.filter.ReadDataSourcesFilter"
     },
-    {
-      "condition": {
-        "typeReached": "org.apache.shardingsphere.sharding.checker.sql.dml.ShardingTableSupportedChecker"
-      },
-      "glob": "META-INF/services/org.apache.shardingsphere.sharding.checker.sql.dml.DialectUnsupportedShardingSQLStatementProvider"
-    },
     {
       "condition": {
         "typeReached": "org.apache.shardingsphere.sqlfederation.compiler.context.connection.config.ConnectionConfigBuilderFactory"
diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
index 85292cd8d81..4d48a75f9a2 100644
--- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
+++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/shardingsphere-infra-reachability-metadata/reachability-metadata.json
@@ -98,6 +98,13 @@
       "type": "com.sun.management.OperatingSystemMXBean",
       "allPublicMethods": true
     },
+    {
+      "condition": {
+        "typeReached": "com.sun.management.UnixOperatingSystemMXBean"
+      },
+      "type": "com.sun.management.UnixOperatingSystemMXBean",
+      "allPublicMethods": true
+    },
     {
       "condition": {
         "typeReached": "com.sun.management.internal.OperatingSystemImpl"
diff --git a/pom.xml b/pom.xml
index 3be03ea6737..eea1107d350 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1082,13 +1082,10 @@
                 <pluginManagement>
                     <plugins>
                         <plugin>
-                            <groupId>org.apache.maven.plugins</groupId>
                             <artifactId>maven-surefire-plugin</artifactId>
                             <version>${maven-surefire-plugin.version}</version>
                             <configuration>
-                                <includes>
-                                    <include>org.apache.shardingsphere.test.natived.**</include>
-                                </includes>
+                                <skipTests>true</skipTests>
                             </configuration>
                         </plugin>
                         <plugin>
@@ -1119,23 +1116,42 @@
                             </configuration>
                             <executions>
                                 <execution>
-                                    <id>build-native</id>
+                                    <id>merge-agent-files-in-integration-test</id>
                                     <goals>
-                                        <goal>compile-no-fork</goal>
+                                        <goal>merge-agent-files</goal>
                                     </goals>
-                                    <phase>package</phase>
+                                    <phase>integration-test</phase>
                                 </execution>
+                                <!--TODO See https://github.com/graalvm/native-build-tools/pull/748 -->
                                 <execution>
-                                    <id>test-native</id>
+                                    <id>metadata-copy-manually</id>
                                     <goals>
-                                        <goal>test</goal>
+                                        <goal>metadata-copy</goal>
                                     </goals>
-                                    <phase>test</phase>
+                                    <phase>deploy</phase>
                                 </execution>
                             </executions>
                         </plugin>
                     </plugins>
                 </pluginManagement>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <includes>
+                                <include>org.apache.shardingsphere.test.natived.**</include>
+                            </includes>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
             </build>
         </profile>
         <profile>
@@ -1145,26 +1161,11 @@
                     <plugins>
                         <plugin>
                             <artifactId>maven-surefire-plugin</artifactId>
+                            <version>${maven-surefire-plugin.version}</version>
                             <configuration>
-                                <includes>
-                                    <include>org.apache.shardingsphere.test.natived.**</include>
-                                </includes>
+                                <skipTests>true</skipTests>
                             </configuration>
                         </plugin>
-                        <!--TODO See https://github.com/graalvm/native-build-tools/issues/727 .-->
-                        <plugin>
-                            <artifactId>maven-jar-plugin</artifactId>
-                            <version>${maven-jar-plugin.version}</version>
-                            <executions>
-                                <execution>
-                                    <id>jar-in-test-phase</id>
-                                    <goals>
-                                        <goal>jar</goal>
-                                    </goals>
-                                    <phase>test</phase>
-                                </execution>
-                            </executions>
-                        </plugin>
                         <plugin>
                             <groupId>org.graalvm.buildtools</groupId>
                             <artifactId>native-maven-plugin</artifactId>
@@ -1187,12 +1188,30 @@
                                     <goals>
                                         <goal>test</goal>
                                     </goals>
-                                    <phase>test</phase>
+                                    <phase>verify</phase>
                                 </execution>
                             </executions>
                         </plugin>
                     </plugins>
                 </pluginManagement>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>
+                            <includes>
+                                <include>org.apache.shardingsphere.test.natived.**</include>
+                            </includes>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>integration-test</goal>
+                                    <goal>verify</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
             </build>
         </profile>
         <profile>
diff --git a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reachability-metadata.json b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reachability-metadata.json
index aeb6ce7428b..23a01cf29f4 100644
--- a/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reachability-metadata.json
+++ b/test/native/src/test/resources/META-INF/native-image/shardingsphere-test-native-test-metadata/reachability-metadata.json
@@ -300,35 +300,23 @@
       },
       "glob": "test-native/sql/**/*.sql"
     },
-    {
-      "condition": {
-        "typeReached": "org.apache.shardingsphere.test.natived.jdbc.databases.SQLServerTest"
-      },
-      "glob": "container-license-acceptance.txt"
-    },
-    {
-      "condition": {
-        "typeReached": "ch.qos.logback.core.util.Loader"
-      },
-      "glob": "logback-test.xml"
-    },
     {
       "condition": {
         "typeReached": "org.apache.shardingsphere.test.natived.jdbc.transactions.base.SeataTest"
       },
-      "glob": "seata-script-client-conf-file.conf"
+      "glob": "*.conf"
     },
     {
       "condition": {
-        "typeReached": "org.apache.shardingsphere.test.natived.jdbc.transactions.base.SeataTest"
+        "typeReached": "org.apache.shardingsphere.test.natived.jdbc.databases.SQLServerTest"
       },
-      "glob": "registry.conf"
+      "glob": "container-license-acceptance.txt"
     },
     {
       "condition": {
-        "typeReached": "org.apache.shardingsphere.test.natived.jdbc.transactions.base.SeataTest"
+        "typeReached": "ch.qos.logback.core.util.Loader"
       },
-      "glob": "seata.conf"
+      "glob": "logback-test.xml"
     }
   ]
 }