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


##########
packaging/bundle-validation/validate.sh:
##########
@@ -268,19 +270,89 @@ 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/docker-test/packaging/hudi-cli-bundle/hudi-cli-with-bundle.sh < 
$WORKDIR/cli/commands.txt 2>&1 | tee $CLI_TEST_DIR/output.txt
+
+    # Verify CLI started successfully
+    if ! grep -q "hudi->" $CLI_TEST_DIR/output.txt; then
+        echo "::error::validate.sh CLI bundle validation failed - CLI did not 
start successfully"
+        return 1
+    fi
+
+    # Verify table was created
+    if [ ! -d "/tmp/hudi-bundles/tests/table/.hoodie" ]; then
+        echo "::error::validate.sh CLI bundle validation failed - 'create' 
command did not execute successfully. Table directory not created."
+        return 1
+    fi
+
+    # Verify table connection
+    if ! grep -q "Metadata for table trips loaded" $CLI_TEST_DIR/output.txt; 
then
+        echo "::error::validate.sh CLI bundle validation failed - 'connect' 
command did not execute successfully. Table connection failed."
+        return 1
+    fi
+
+    # Verify table description
+    if ! grep -q "hoodie.table.name.*trips" $CLI_TEST_DIR/output.txt; then
+        echo "::error::validate.sh CLI bundle validation failed - 'desc' 
command did not execute successfully. Table properties are missing."
+        return 1
+    fi
+
+    # Verify commit history
+    if ! grep -q "CommitTime" $CLI_TEST_DIR/output.txt; then
+        echo "::error::validate.sh CLI bundle validation failed - 'commits 
show' command did not execute successfully. No commit history found."
+        return 1
+    fi
+
+    echo "::warning::validate.sh CLI bundle validation was successful"
+    return 0
+}
 
 ############################
 # Execute tests
 ############################
 
+if [[ $SPARK_HOME == *"spark-3.5"* ]]

Review Comment:
   To leverage the table created by Spark bundle, this has to be moved below 
`echo "::warning::validate.sh done validating spark & hadoop-mr bundle"`.



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