From 6ea9268bcb703119a3a15b868202eb7c3f3bce1a Mon Sep 17 00:00:00 2001 From: Armando Zhu Date: Thu, 15 Feb 2024 17:36:02 +0000 Subject: [PATCH] ci: Add hdfs test case for azurite azblob (#4168) --- .../hdfs_default_on_azurite_azblob/action.yml | 71 +++++++++++++++++++ fixtures/hdfs/azurite-azblob-core-site.xml | 41 +++++++++++ 2 files changed, 112 insertions(+) create mode 100644 .github/services/hdfs/hdfs_default_on_azurite_azblob/action.yml create mode 100644 fixtures/hdfs/azurite-azblob-core-site.xml diff --git a/.github/services/hdfs/hdfs_default_on_azurite_azblob/action.yml b/.github/services/hdfs/hdfs_default_on_azurite_azblob/action.yml new file mode 100644 index 000000000000..94a2763af763 --- /dev/null +++ b/.github/services/hdfs/hdfs_default_on_azurite_azblob/action.yml @@ -0,0 +1,71 @@ +# 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. + +name: hdfs_default_on_azurite_azblob +description: 'Behavior test for hdfs default over azurite azblob' + +runs: + using: "composite" + steps: + - name: Setup java env + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "11" + - name: Setup azurite azblob service + shell: bash + working-directory: fixtures/azblob + run: docker compose -f docker-compose-azurite.yml up -d --wait + - name: Setup test bucket + shell: bash + run: | + az storage container create \ + --name test \ + --connection-string "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;" + - name: Setup + shell: bash + run: | + OPENDAL_AZBLOB_CONTAINER=test + OPENDAL_AZBLOB_ACCOUNT_NAME=devstoreaccount1 + OPENDAL_AZBLOB_ACCOUNT_KEY=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw== + + curl -LsSf https://dlcdn.apache.org/hadoop/common/hadoop-3.3.5/hadoop-3.3.5.tar.gz | tar zxf - -C /home/runner + + export HADOOP_HOME="/home/runner/hadoop-3.3.5" + + curl -LsSf -o ${HADOOP_HOME}/share/hadoop/common/lib/hadoop-azure-3.3.5.jar https://repo1.maven.org/maven2/org/apache/hadoop/hadoop-azure/3.3.5/hadoop-azure-3.3.5.jar + curl -LsSf -o ${HADOOP_HOME}/share/hadoop/common/lib/azure-storage-7.0.1.jar https://repo1.maven.org/maven2/com/microsoft/azure/azure-storage/7.0.1/azure-storage-7.0.1.jar + + export CLASSPATH=$(${HADOOP_HOME}/bin/hadoop classpath --glob) + + mkdir -p /tmp/hdfs + + pushd ${HADOOP_HOME} + ./bin/hadoop credential create fs.azure.account.key.${OPENDAL_AZBLOB_ACCOUNT_NAME}.blob.core.windows.net -value ${OPENDAL_AZBLOB_ACCOUNT_KEY} -provider localjceks://file/tmp/hdfs/azurite-wasb.jceks + popd + + cp ./fixtures/hdfs/hdfs-site.xml ${HADOOP_HOME}/etc/hadoop/hdfs-site.xml + cp ./fixtures/hdfs/azurite-azblob-core-site.xml ${HADOOP_HOME}/etc/hadoop/core-site.xml + + cat << EOF >> $GITHUB_ENV + HADOOP_HOME=${HADOOP_HOME} + CLASSPATH=${CLASSPATH} + LD_LIBRARY_PATH=${JAVA_HOME}/lib/server:${HADOOP_HOME}/lib/native + OPENDAL_HDFS_ROOT=${OPENDAL_AZBLOB_ROOT} + OPENDAL_HDFS_NAME_NODE=wasb://${OPENDAL_AZBLOB_CONTAINER}@${OPENDAL_AZBLOB_ACCOUNT_NAME}.blob.core.windows.net + OPENDAL_HDFS_ENABLE_APPEND=false + EOF diff --git a/fixtures/hdfs/azurite-azblob-core-site.xml b/fixtures/hdfs/azurite-azblob-core-site.xml new file mode 100644 index 000000000000..834ff74e6b0f --- /dev/null +++ b/fixtures/hdfs/azurite-azblob-core-site.xml @@ -0,0 +1,41 @@ + + + + + + + + + + fs.azure.test.emulator + true + + + fs.azure.storage.emulator.account.name + devstoreaccount1.blob.core.windows.net + + + hadoop.security.credential.provider.path + localjceks://file/tmp/hdfs/azurite-wasb.jceks + Path to interrogate for protected azure blob storage credentials. + +