yihua commented on code in PR #12882:
URL: https://github.com/apache/hudi/pull/12882#discussion_r1978421131


##########
packaging/bundle-validation/cli/hudi-cli-with-bundle.sh:
##########
@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+
+#  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.
+
+JAKARTA_EL_VERSION=3.0.3

Review Comment:
   Is this script the same as 
`packaging/hudi-cli-bundle/hudi-cli-with-bundle.sh`?  If so, could we reuse 
that instead of adding this script file again?



##########
packaging/bundle-validation/ci_run.sh:
##########
@@ -145,27 +147,33 @@ if [ -z "$STAGING_REPO_NUM" ] && [ -z "$MAVEN_BASE_URL" 
]; then
 else
   echo 'Adding environment variables for bundles in the release candidate or 
artifact'
 
+  HUDI_CLI_BUNDLE_NAME=hudi-cli-bundle

Review Comment:
   Similarly, we can get rid of this line as the bundle name is scala version 
specific and this line is not used (i.e., the env var is reassigned in the 
if-else branch).



##########
packaging/bundle-validation/validate.sh:
##########
@@ -268,19 +269,70 @@ test_metaserver_bundle () {
     kill $DERBY_PID $HIVE_PID $METASEVER_PID
 }
 
+##
+# Function to test the hudi-cli bundle.
+# It creates a test table and connects to it using CLI commands
+#
+# env vars
+#   SPARK_HOME: path to the spark directory
+#   CLI_BUNDLE_JAR: path to the hudi cli bundle jar
+#   SPARK_BUNDLE_JAR: path to the hudi spark bundle jar
+##
+test_cli_bundle() {
+    echo "::warning::validate.sh setting up CLI bundle validation"
+
+    # Create a temporary directory for CLI commands output
+    CLI_TEST_DIR="/tmp/hudi-bundles/tests/log"
+    mkdir -p $CLI_TEST_DIR
+
+    # Set required environment variables
+    export SPARK_HOME=$SPARK_HOME
+    export CLI_BUNDLE_JAR=$JARS_DIR/cli.jar
+    export SPARK_BUNDLE_JAR=$JARS_DIR/spark.jar
+
+    # Execute with debug output
+    echo "Executing Hudi CLI commands..."
+    $WORKDIR/cli/hudi-cli-with-bundle.sh < $WORKDIR/cli/commands.txt 2>&1 | 
tee $CLI_TEST_DIR/output.txt
+
+    # Verify table was created
+    if [ ! -d "/tmp/hudi-bundles/tests/table/.hoodie" ]; then
+        echo "::error::validate.sh CLI bundle validation failed - Table 
directory not created"
+        return 1
+    fi
+
+    if ! grep -q "Metadata for table trips loaded" $CLI_TEST_DIR/output.txt; 
then
+        echo "::error::validate.sh CLI bundle validation failed - Table 
connection failed"
+        return 1

Review Comment:
   Could stricter validation be added on `output.txt`, e.g., parsing and 
checking the result of CLI commands?



##########
packaging/bundle-validation/ci_run.sh:
##########
@@ -133,10 +133,12 @@ if [ -z "$STAGING_REPO_NUM" ] && [ -z "$MAVEN_BASE_URL" 
]; then
   echo 'Adding built bundle jars for validation'
   if [[ "$SCALA_PROFILE" != 'scala-2.13' ]]; then
     # For Scala 2.13, Flink is not support, so skipping the Flink bundle 
validation
+    cp 
${GITHUB_WORKSPACE}/packaging/hudi-cli-bundle/target/hudi-*-$HUDI_VERSION.jar 
$TMP_JARS_DIR/

Review Comment:
   This line is redundant as `L141` always copy the CLI bundle jar.



##########
packaging/bundle-validation/cli/commands.txt:
##########
@@ -0,0 +1,5 @@
+create --path file:///tmp/hudi-bundles/tests/table --tableName trips 
--tableType COPY_ON_WRITE
+connect --path file:///tmp/hudi-bundles/tests/table
+desc
+commits show
+exit

Review Comment:
   Do you plan to add more commands to increase the coverage?



-- 
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]

Reply via email to