From 7592ac3bead2c30b468ffd0087b4c941a69c35b8 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 12:37:50 +0800 Subject: [PATCH 01/18] Save work Signed-off-by: Xuanwo --- .github/workflows/{test_planner.yml => behavior_test.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{test_planner.yml => behavior_test.yml} (99%) diff --git a/.github/workflows/test_planner.yml b/.github/workflows/behavior_test.yml similarity index 99% rename from .github/workflows/test_planner.yml rename to .github/workflows/behavior_test.yml index 29eabd6f998e..bc53b4d5923b 100644 --- a/.github/workflows/test_planner.yml +++ b/.github/workflows/behavior_test.yml @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -name: Test +name: Behavior Test on: push: From 9b2b085384056a3163833ff5b7ae0d53703e63cd Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 13:14:02 +0800 Subject: [PATCH 02/18] Renaming Signed-off-by: Xuanwo --- .../{test-core => behavior_test_core}/action.yaml | 2 +- .../scripts/behavior_test_plan.py | 0 .github/workflows/behavior_test.yml | 6 +++--- .../workflows/{core_test.yml => behavior_test_core.yml} | 9 +++++---- 4 files changed, 9 insertions(+), 8 deletions(-) rename .github/actions/{test-core => behavior_test_core}/action.yaml (98%) rename scripts/workflow_planner.py => .github/scripts/behavior_test_plan.py (100%) rename .github/workflows/{core_test.yml => behavior_test_core.yml} (91%) diff --git a/.github/actions/test-core/action.yaml b/.github/actions/behavior_test_core/action.yaml similarity index 98% rename from .github/actions/test-core/action.yaml rename to .github/actions/behavior_test_core/action.yaml index 7e29b6b411f0..2447ac920a81 100644 --- a/.github/actions/test-core/action.yaml +++ b/.github/actions/behavior_test_core/action.yaml @@ -44,7 +44,7 @@ runs: - name: Run Test Core shell: bash working-directory: core - run: cargo nextest run behavior --archive-file=./core-test.tar.zst + run: cargo nextest run behavior --archive-file=./test-core.tar.zst env: OPENDAL_TEST: ${{ inputs.service }} EOF diff --git a/scripts/workflow_planner.py b/.github/scripts/behavior_test_plan.py similarity index 100% rename from scripts/workflow_planner.py rename to .github/scripts/behavior_test_plan.py diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index bc53b4d5923b..04a60b02281a 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -73,12 +73,12 @@ jobs: export GITHUB_IS_PUSH=$is_push # Run the workflow planner script - PLAN=$(./scripts/workflow_planner.py $files_changed) + PLAN=$(./.github/scripts/behavior_test_plan.py $files_changed) echo "Plan:" echo "$PLAN" | jq . echo "plan=$PLAN" >> $GITHUB_OUTPUT - core_test: + test_core: name: core / ${{ matrix.os }} needs: [plan] if: fromJson(needs.plan.outputs.plan).components.core @@ -86,7 +86,7 @@ jobs: strategy: matrix: include: ${{ fromJson(needs.plan.outputs.plan).core }} - uses: ./.github/workflows/core_test.yml + uses: ./.github/workflows/behavior_test_core.yml with: os: ${{ matrix.os }} cases: ${{ toJson(matrix.cases) }} diff --git a/.github/workflows/core_test.yml b/.github/workflows/behavior_test_core.yml similarity index 91% rename from .github/workflows/core_test.yml rename to .github/workflows/behavior_test_core.yml index 9cd213d4e817..3d16b11112e7 100644 --- a/.github/workflows/core_test.yml +++ b/.github/workflows/behavior_test_core.yml @@ -56,13 +56,13 @@ jobs: shell: bash working-directory: core run: | - cargo nextest archive --features ${{ inputs.features }} --archive-file ./core-test.tar.zst + cargo nextest archive --features ${{ inputs.features }} --archive-file ./test-core.tar.zst - name: Upload uses: actions/upload-artifact@v3 with: - name: ${{ inputs.os }}-core-test - path: ./core/core-test.tar.zst + name: ${{ inputs.os }}-test-core + path: ./core/test-core.tar.zst test: name: ${{ matrix.cases.service }} / ${{ matrix.cases.setup }} @@ -79,11 +79,12 @@ jobs: need-nextest: true need-protoc: true need-rocksdb: true + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Download uses: actions/download-artifact@v3 with: - name: ${{ inputs.os }}-core-test + name: ${{ inputs.os }}-test-core path: ./core - name: Test Core From 7e7baacd593640100574e33cff38495492d95fe7 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:30:09 +0800 Subject: [PATCH 03/18] Refactor python Signed-off-by: Xuanwo --- .github/scripts/__init__.py | 17 +++++++++ .github/scripts/behavior_test_plan.py | 22 +++++++++-- .github/scripts/test_behavior_test_plan.py | 43 ++++++++++++++++++++++ .gitignore | 3 ++ 4 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 .github/scripts/__init__.py create mode 100644 .github/scripts/test_behavior_test_plan.py diff --git a/.github/scripts/__init__.py b/.github/scripts/__init__.py new file mode 100644 index 000000000000..dae607cde22e --- /dev/null +++ b/.github/scripts/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +# 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. diff --git a/.github/scripts/behavior_test_plan.py b/.github/scripts/behavior_test_plan.py index 534c68ae5dd3..65fe55ef8aae 100755 --- a/.github/scripts/behavior_test_plan.py +++ b/.github/scripts/behavior_test_plan.py @@ -21,9 +21,21 @@ import os from pathlib import Path +# The path for current script. +SCRIPT_PATH = Path(__file__).parent.absolute() +print(f"SCRIPT_PATH: {SCRIPT_PATH}") + +# The path for `.github` dir. +GITHUB_DIR = SCRIPT_PATH.parent +print(f"GITHUB_DIR: {GITHUB_DIR}") + +# The project dir for opendal. +PROJECT_DIR = GITHUB_DIR.parent +print(f"PROJECT_DIR: {PROJECT_DIR}") + def get_provided_cases(): - root_dir = ".github/services" + root_dir = f"{GITHUB_DIR}/services" cases = [ { @@ -62,7 +74,9 @@ def calculate_core_cases(cases, changed_files): # If any of the core files changed, we will run all cases. if any( - p.startswith("core/src/") and not p.startswith("core/src/services") + p.startswith("core/") + and not p.startswith("core/src/services/") + and not p.endswith(".md") for p in changed_files ): return cases @@ -108,7 +122,7 @@ def plan(changed_files): } ) - return json.dumps(jobs) + return jobs # For quick test: @@ -117,4 +131,4 @@ def plan(changed_files): if __name__ == "__main__": changed_files = sys.argv[1:] result = plan(changed_files) - print(result) + print(json.dumps(result)) diff --git a/.github/scripts/test_behavior_test_plan.py b/.github/scripts/test_behavior_test_plan.py new file mode 100644 index 000000000000..5f2a662b03cc --- /dev/null +++ b/.github/scripts/test_behavior_test_plan.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +# 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. + +import unittest +from behavior_test_plan import plan + + +class BehaviorTestPlan(unittest.TestCase): + def test_empty(self): + result = plan([]) + self.assertEqual(result, {}) + + def test_core_cargo_toml(self): + result = plan(["core/Cargo.toml"]) + self.assertTrue(result["components"]["core"]) + + def test_core_services_fs(self): + result = plan(["core/src/services/fs/mod.rs"]) + self.assertTrue(result["components"]["core"]) + self.assertTrue(len(result["core"]) > 0) + # Should not contain fs + self.assertTrue("services-fs" in result["core"][0]["features"]) + # Should not contain s3 + self.assertFalse("services-s3" in result["core"][0]["features"]) + + +if __name__ == "__main__": + unittest.main() diff --git a/.gitignore b/.gitignore index d5fd6da84020..dc9a92312a98 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ perf.* # Yarn Integrity file .yarn-integrity + +# Python cache files +**/__pycache__/ From ed7d72bae55b61dd68717260a278d87333c4c91e Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:32:33 +0800 Subject: [PATCH 04/18] refactor Signed-off-by: Xuanwo --- .github/scripts/{ => behavior_test}/__init__.py | 1 - .../scripts/{behavior_test_plan.py => behavior_test/plan.py} | 0 .../{test_behavior_test_plan.py => behavior_test/test_plan.py} | 3 +-- .github/workflows/behavior_test.yml | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) rename .github/scripts/{ => behavior_test}/__init__.py (97%) rename .github/scripts/{behavior_test_plan.py => behavior_test/plan.py} (100%) rename .github/scripts/{test_behavior_test_plan.py => behavior_test/test_plan.py} (96%) diff --git a/.github/scripts/__init__.py b/.github/scripts/behavior_test/__init__.py similarity index 97% rename from .github/scripts/__init__.py rename to .github/scripts/behavior_test/__init__.py index dae607cde22e..13a83393a912 100644 --- a/.github/scripts/__init__.py +++ b/.github/scripts/behavior_test/__init__.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # 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 diff --git a/.github/scripts/behavior_test_plan.py b/.github/scripts/behavior_test/plan.py similarity index 100% rename from .github/scripts/behavior_test_plan.py rename to .github/scripts/behavior_test/plan.py diff --git a/.github/scripts/test_behavior_test_plan.py b/.github/scripts/behavior_test/test_plan.py similarity index 96% rename from .github/scripts/test_behavior_test_plan.py rename to .github/scripts/behavior_test/test_plan.py index 5f2a662b03cc..d023095ff986 100644 --- a/.github/scripts/test_behavior_test_plan.py +++ b/.github/scripts/behavior_test/test_plan.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 # 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 @@ -17,7 +16,7 @@ # under the License. import unittest -from behavior_test_plan import plan +from plan import plan class BehaviorTestPlan(unittest.TestCase): diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index 04a60b02281a..3997f8b0c55f 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -73,7 +73,7 @@ jobs: export GITHUB_IS_PUSH=$is_push # Run the workflow planner script - PLAN=$(./.github/scripts/behavior_test_plan.py $files_changed) + PLAN=$(./.github/scripts/behavior_test/plan.py $files_changed) echo "Plan:" echo "$PLAN" | jq . echo "plan=$PLAN" >> $GITHUB_OUTPUT From a22de2da9fc524a7d721e675fcbcf675d958891f Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:51:36 +0800 Subject: [PATCH 05/18] Refactor Signed-off-by: Xuanwo --- .github/services/fs/local-fs/action.yml | 2 +- .github/services/s3/aws-s3/action.yml | 26 ++++++++++-------------- .github/workflows/behavior_test_core.yml | 9 ++++++-- .github/workflows/service_test_s3.yml | 1 - 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/services/fs/local-fs/action.yml b/.github/services/fs/local-fs/action.yml index 72d54608c061..7b36dc3a9a40 100644 --- a/.github/services/fs/local-fs/action.yml +++ b/.github/services/fs/local-fs/action.yml @@ -16,7 +16,7 @@ # under the License. name: local_fs -description: "Setup local fs" +description: 'Behavior test for local fs' runs: using: "composite" diff --git a/.github/services/s3/aws-s3/action.yml b/.github/services/s3/aws-s3/action.yml index b560b443416a..ce95ec8632e1 100644 --- a/.github/services/s3/aws-s3/action.yml +++ b/.github/services/s3/aws-s3/action.yml @@ -16,23 +16,19 @@ # under the License. name: aws_s3 -description: "Setup AWS S3" +description: 'Behavior test for AWS S3. This service is sponsored by @datafuse_labs.' -inputs: - secrets: - description: "The secrets for test" - default: "{}" - -# TODO: we should migrate to 1password instead. runs: using: "composite" steps: - name: Setup - shell: bash - run: | - echo "OPENDAL_S3_ROOT=${{ fromJson(inputs.secrets).OPENDAL_S3_ROOT }}" >> $GITHUB_ENV - echo "OPENDAL_S3_BUCKET=${{ fromJson(inputs.secrets).OPENDAL_S3_BUCKET }}" >> $GITHUB_ENV - echo "OPENDAL_S3_ENDPOINT=${{ fromJson(inputs.secrets).OPENDAL_S3_ENDPOINT }}" >> $GITHUB_ENV - echo "OPENDAL_S3_ACCESS_KEY_ID=${{ fromJson(inputs.secrets).OPENDAL_S3_ACCESS_KEY_ID }}" >> $GITHUB_ENV - echo "OPENDAL_S3_SECRET_ACCESS_KEY=${{ fromJson(inputs.secrets).OPENDAL_S3_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV - echo "OPENDAL_S3_REGION=ap-northeast-1" >> $GITHUB_ENV + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_S3_ROOT: op://services/s3/root + OPENDAL_S3_BUCKET: op://services/s3/bucket + OPENDAL_S3_ENDPOINT: op://services/s3/endpoint + OPENDAL_S3_ACCESS_KEY_ID: op://services/s3/access_key_id + OPENDAL_S3_SECRET_ACCESS_KEY: op://services/s3/secret_access_key + OPENDAL_S3_REGION: op://services/s3/region diff --git a/.github/workflows/behavior_test_core.yml b/.github/workflows/behavior_test_core.yml index 3d16b11112e7..748f5ba341ef 100644 --- a/.github/workflows/behavior_test_core.yml +++ b/.github/workflows/behavior_test_core.yml @@ -87,9 +87,14 @@ jobs: name: ${{ inputs.os }}-test-core path: ./core + # TODO: 1password is only supported on linux, waiting for https://github.com/1Password/load-secrets-action/issues/46 + - name: Setup service account token for 1password + if: runner.os == 'Linux' + shell: bash + run: echo "OP_SERVICE_ACCOUNT_TOKEN=${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}" >> $GITHUB_ENV + - name: Test Core - uses: ./.github/actions/test-core + uses: ./.github/actions/behavior_test_core with: setup: ${{ matrix.cases.setup }} service: ${{ matrix.cases.service }} - secrets: ${{ toJson(secrets) }} diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml index d97a36bb4bad..efa8b1e4a027 100644 --- a/.github/workflows/service_test_s3.yml +++ b/.github/workflows/service_test_s3.yml @@ -197,7 +197,6 @@ jobs: need-nextest: true - name: Load secret - id: op-load-secret uses: 1password/load-secrets-action@v1 with: export-env: true From 0200f055dac2d70d06609dca332096552c1cafb0 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:53:06 +0800 Subject: [PATCH 06/18] Fix Signed-off-by: Xuanwo --- .github/scripts/behavior_test/plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/behavior_test/plan.py b/.github/scripts/behavior_test/plan.py index 65fe55ef8aae..b0af806e871c 100755 --- a/.github/scripts/behavior_test/plan.py +++ b/.github/scripts/behavior_test/plan.py @@ -26,7 +26,7 @@ print(f"SCRIPT_PATH: {SCRIPT_PATH}") # The path for `.github` dir. -GITHUB_DIR = SCRIPT_PATH.parent +GITHUB_DIR = SCRIPT_PATH.parent.parent print(f"GITHUB_DIR: {GITHUB_DIR}") # The project dir for opendal. From 2ef056f72088a298982de16b0ea73ac4359c9e57 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:54:51 +0800 Subject: [PATCH 07/18] remove debug log Signed-off-by: Xuanwo --- .github/scripts/behavior_test/plan.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/scripts/behavior_test/plan.py b/.github/scripts/behavior_test/plan.py index b0af806e871c..e1fd25ff3f98 100755 --- a/.github/scripts/behavior_test/plan.py +++ b/.github/scripts/behavior_test/plan.py @@ -23,15 +23,10 @@ # The path for current script. SCRIPT_PATH = Path(__file__).parent.absolute() -print(f"SCRIPT_PATH: {SCRIPT_PATH}") - # The path for `.github` dir. GITHUB_DIR = SCRIPT_PATH.parent.parent -print(f"GITHUB_DIR: {GITHUB_DIR}") - # The project dir for opendal. PROJECT_DIR = GITHUB_DIR.parent -print(f"PROJECT_DIR: {PROJECT_DIR}") def get_provided_cases(): From ebe1f69bbcdcb91f18e0e93aca87dc0c41d312b9 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:57:22 +0800 Subject: [PATCH 08/18] Fix file changed Signed-off-by: Xuanwo --- .github/workflows/behavior_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index 3997f8b0c55f..3925a1322ed1 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -65,7 +65,7 @@ jobs: git fetch origin main:main files_changed=$(git diff --name-only main ${{ github.event.pull_request.head.sha }}) echo "Files changed:" - echo "$FILES_CHANGED" + echo "$files_changed" fi # Export variables From 390bb1839a1ecae9062a957f5326ded7bae1bf1d Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 15:59:51 +0800 Subject: [PATCH 09/18] compare with pr base Signed-off-by: Xuanwo --- .github/workflows/behavior_test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index 3925a1322ed1..838b605ab3db 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -62,8 +62,7 @@ jobs: has_secrets="true" fi - git fetch origin main:main - files_changed=$(git diff --name-only main ${{ github.event.pull_request.head.sha }}) + files_changed=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) echo "Files changed:" echo "$files_changed" fi From 3e8872a2190e3e92c9f6eded9ff2405067ba95f6 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 16:14:45 +0800 Subject: [PATCH 10/18] Migrate Signed-off-by: Xuanwo --- .../fs/{local-fs => local_fs}/action.yml | 0 .../services/s3/{aws-s3 => aws_s3}/action.yml | 0 .../s3/aws_s3_with_assume_role/action.yml | 39 +++++++++++++++ .../services/s3/aws_s3_with_sse_c/action.yml | 41 +++++++++++++++ .../s3/aws_s3_with_virtual_host/action.yml | 39 +++++++++++++++ .github/workflows/service_test_s3.yml | 50 +------------------ 6 files changed, 120 insertions(+), 49 deletions(-) rename .github/services/fs/{local-fs => local_fs}/action.yml (100%) rename .github/services/s3/{aws-s3 => aws_s3}/action.yml (100%) create mode 100644 .github/services/s3/aws_s3_with_assume_role/action.yml create mode 100644 .github/services/s3/aws_s3_with_sse_c/action.yml create mode 100644 .github/services/s3/aws_s3_with_virtual_host/action.yml diff --git a/.github/services/fs/local-fs/action.yml b/.github/services/fs/local_fs/action.yml similarity index 100% rename from .github/services/fs/local-fs/action.yml rename to .github/services/fs/local_fs/action.yml diff --git a/.github/services/s3/aws-s3/action.yml b/.github/services/s3/aws_s3/action.yml similarity index 100% rename from .github/services/s3/aws-s3/action.yml rename to .github/services/s3/aws_s3/action.yml diff --git a/.github/services/s3/aws_s3_with_assume_role/action.yml b/.github/services/s3/aws_s3_with_assume_role/action.yml new file mode 100644 index 000000000000..db5ee5db7393 --- /dev/null +++ b/.github/services/s3/aws_s3_with_assume_role/action.yml @@ -0,0 +1,39 @@ +# 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: aws_s3_with_assume_role +description: 'Behavior test for AWS S3 with assume role. This service is sponsored by @datafuse_labs.' + +runs: + using: "composite" + steps: + - name: Setup + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_S3_ROOT: op://services/s3/root + OPENDAL_S3_BUCKET: op://services/s3/bucket + OPENDAL_S3_ENDPOINT: op://services/s3/endpoint + OPENDAL_S3_ACCESS_KEY_ID: op://services/s3/access_key_id + OPENDAL_S3_SECRET_ACCESS_KEY: op://services/s3/secret_access_key + OPENDAL_S3_REGION: op://services/s3/region + + - name: Add extra settings + shell: bash + run: + echo "OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE=on" >> $GITHUB_ENV diff --git a/.github/services/s3/aws_s3_with_sse_c/action.yml b/.github/services/s3/aws_s3_with_sse_c/action.yml new file mode 100644 index 000000000000..c28416a44a76 --- /dev/null +++ b/.github/services/s3/aws_s3_with_sse_c/action.yml @@ -0,0 +1,41 @@ +# 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: aws_s3_with_sse_c +description: 'Behavior test for AWS S3 with SSE-C. This service is sponsored by @datafuse_labs.' + +runs: + using: "composite" + steps: + - name: Setup + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_S3_ROOT: op://services/s3/root + OPENDAL_S3_BUCKET: op://services/s3/bucket + OPENDAL_S3_ENDPOINT: op://services/s3/endpoint + OPENDAL_S3_ACCESS_KEY_ID: op://services/s3/access_key_id + OPENDAL_S3_SECRET_ACCESS_KEY: op://services/s3/secret_access_key + OPENDAL_S3_REGION: op://services/s3/region + + - name: Add extra settings + shell: bash + run: + echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM=AES256" >> $GITHUB_ENV + echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY=MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=" >> $GITHUB_ENV + echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5=zZ5FnqcIqUjVwvWmyog4zw==" >> $GITHUB_ENV diff --git a/.github/services/s3/aws_s3_with_virtual_host/action.yml b/.github/services/s3/aws_s3_with_virtual_host/action.yml new file mode 100644 index 000000000000..3e7e1ebf57ae --- /dev/null +++ b/.github/services/s3/aws_s3_with_virtual_host/action.yml @@ -0,0 +1,39 @@ +# 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: aws_s3_with_virtual_host +description: 'Behavior test for AWS S3 with virtual host. This service is sponsored by @datafuse_labs.' + +runs: + using: "composite" + steps: + - name: Setup + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_S3_ROOT: op://services/s3/root + OPENDAL_S3_BUCKET: op://services/s3/bucket + OPENDAL_S3_ENDPOINT: op://services/s3/endpoint + OPENDAL_S3_ACCESS_KEY_ID: op://services/s3/access_key_id + OPENDAL_S3_SECRET_ACCESS_KEY: op://services/s3/secret_access_key + OPENDAL_S3_REGION: op://services/s3/region + + - name: Add extra settings + shell: bash + run: + echo "OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE=on" >> $GITHUB_ENV diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml index 5cb35faad0c8..0a42c0b7c74b 100644 --- a/.github/workflows/service_test_s3.yml +++ b/.github/workflows/service_test_s3.yml @@ -39,54 +39,6 @@ concurrency: cancel-in-progress: true jobs: - aws_s3_with_virtual_host: - runs-on: ubuntu-latest - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - name: Test - shell: bash - working-directory: core - run: cargo nextest run behavior - env: - OPENDAL_TEST: s3 - OPENDAL_S3_ROOT: ${{ secrets.OPENDAL_S3_ROOT }} - OPENDAL_S3_BUCKET: ${{ secrets.OPENDAL_S3_BUCKET }} - OPENDAL_S3_ENDPOINT: ${{ secrets.OPENDAL_S3_ENDPOINT }} - OPENDAL_S3_ACCESS_KEY_ID: ${{ secrets.OPENDAL_S3_ACCESS_KEY_ID }} - OPENDAL_S3_SECRET_ACCESS_KEY: ${{ secrets.OPENDAL_S3_SECRET_ACCESS_KEY }} - OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE: on - OPENDAL_S3_REGION: ap-northeast-1 - - aws_s3_with_sse_c: - runs-on: ubuntu-latest - if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - name: Test - shell: bash - working-directory: core - run: cargo nextest run behavior - env: - OPENDAL_TEST: s3 - OPENDAL_S3_ROOT: ${{ secrets.OPENDAL_S3_ROOT }} - OPENDAL_S3_BUCKET: ${{ secrets.OPENDAL_S3_BUCKET }} - OPENDAL_S3_ENDPOINT: ${{ secrets.OPENDAL_S3_ENDPOINT }} - OPENDAL_S3_ACCESS_KEY_ID: ${{ secrets.OPENDAL_S3_ACCESS_KEY_ID }} - OPENDAL_S3_SECRET_ACCESS_KEY: ${{ secrets.OPENDAL_S3_SECRET_ACCESS_KEY }} - OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM: AES256 - OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY: MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA= - OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5: zZ5FnqcIqUjVwvWmyog4zw== - OPENDAL_S3_REGION: ap-northeast-1 - aws_s3_with_assume_role: runs-on: ubuntu-latest if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork @@ -237,7 +189,7 @@ jobs: - name: Test shell: bash working-directory: bindings/java - run: ./mvnw test -Dtest="behavior.*Test" + run: ./mvnw test -Dtest="behavior.*Test" env: OPENDAL_TEST: s3 OPENDAL_S3_BUCKET: test From ae4b5592c47933227f937f1c666f5bb775b689dd Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 16:22:24 +0800 Subject: [PATCH 11/18] migrate existing s3 tests Signed-off-by: Xuanwo --- .../services/s3/aws_s3_with_sse_c/action.yml | 8 +- .github/services/s3/minio_s3/action.yml | 44 +++++++++ .../s3/minio_s3_with_anonymous/action.yml | 50 ++++++++++ .github/services/s3/r2/action.yml | 42 ++++++++ .github/workflows/service_test_s3.yml | 99 ------------------- 5 files changed, 141 insertions(+), 102 deletions(-) create mode 100644 .github/services/s3/minio_s3/action.yml create mode 100644 .github/services/s3/minio_s3_with_anonymous/action.yml create mode 100644 .github/services/s3/r2/action.yml diff --git a/.github/services/s3/aws_s3_with_sse_c/action.yml b/.github/services/s3/aws_s3_with_sse_c/action.yml index c28416a44a76..507fc4922cb7 100644 --- a/.github/services/s3/aws_s3_with_sse_c/action.yml +++ b/.github/services/s3/aws_s3_with_sse_c/action.yml @@ -36,6 +36,8 @@ runs: - name: Add extra settings shell: bash run: - echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM=AES256" >> $GITHUB_ENV - echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY=MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=" >> $GITHUB_ENV - echo "OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5=zZ5FnqcIqUjVwvWmyog4zw==" >> $GITHUB_ENV + cat << EOF >> $GITHUB_ENV + OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM=AES256 + OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY=MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA= + OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY_MD5=zZ5FnqcIqUjVwvWmyog4zw== + EOF diff --git a/.github/services/s3/minio_s3/action.yml b/.github/services/s3/minio_s3/action.yml new file mode 100644 index 000000000000..e74a63449b0a --- /dev/null +++ b/.github/services/s3/minio_s3/action.yml @@ -0,0 +1,44 @@ +# 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: minio_s3 +description: 'Behavior test for Minio S3.' + +runs: + using: "composite" + steps: + - name: Setup MinIO Server + shell: bash + working-directory: fixtures/s3 + run: docker-compose -f docker-compose-minio.yml up -d + - name: Setup test bucket + shell: bash + env: + AWS_ACCESS_KEY_ID: "minioadmin" + AWS_SECRET_ACCESS_KEY: "minioadmin" + AWS_EC2_METADATA_DISABLED: "true" + run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test + - name: Setup + shell: bash + run: + cat << EOF >> $GITHUB_ENV + OPENDAL_S3_BUCKET=test + OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" + OPENDAL_S3_ACCESS_KEY_ID=minioadmin + OPENDAL_S3_SECRET_ACCESS_KEY=minioadmin + OPENDAL_S3_REGION=us-east-1 + EOF diff --git a/.github/services/s3/minio_s3_with_anonymous/action.yml b/.github/services/s3/minio_s3_with_anonymous/action.yml new file mode 100644 index 000000000000..99308dd775e2 --- /dev/null +++ b/.github/services/s3/minio_s3_with_anonymous/action.yml @@ -0,0 +1,50 @@ +# 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: minio_s3_with_anonymous +description: 'Behavior test for Minio S3 with anonymous access.' + +runs: + using: "composite" + steps: + - name: Setup MinIO Server + shell: bash + working-directory: fixtures/s3 + run: | + docker-compose -f docker-compose-minio.yml up -d + - name: Setup test bucket + shell: bash + env: + AWS_ACCESS_KEY_ID: "minioadmin" + AWS_SECRET_ACCESS_KEY: "minioadmin" + AWS_EC2_METADATA_DISABLED: "true" + run: | + aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test + + curl -O https://dl.min.io/client/mc/release/linux-amd64/mc + chmod +x mc + ./mc alias set local http://127.0.0.1:9000/ minioadmin minioadmin + ./mc anonymous set public local/test + - name: Setup + shell: bash + run: + cat << EOF >> $GITHUB_ENV + OPENDAL_S3_BUCKET=test + OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" + OPENDAL_S3_REGION=us-east-1 + OPENDAL_S3_ALLOW_ANONYMOUS=on + EOF diff --git a/.github/services/s3/r2/action.yml b/.github/services/s3/r2/action.yml new file mode 100644 index 000000000000..cfbd1e4fd549 --- /dev/null +++ b/.github/services/s3/r2/action.yml @@ -0,0 +1,42 @@ +# 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: r2 +description: 'Behavior test for Cloudflare R2. This service is sponsored by @Xuanwo.' + +runs: + using: "composite" + steps: + - name: Setup + uses: 1password/load-secrets-action@v1 + with: + export-env: true + env: + OPENDAL_S3_BUCKET: op://services/r2/bucket + OPENDAL_S3_ENDPOINT: op://services/r2/endpoint + OPENDAL_S3_ACCESS_KEY_ID: op://services/r2/access_key_id + OPENDAL_S3_SECRET_ACCESS_KEY: op://services/r2/secret_access_key + + # OPENDAL_S3_BATCH_MAX_OPERATIONS is the R2's limitation + # Refer to https://opendal.apache.org/docs/services/s3#compatible-services for more information + - name: Add extra settings + shell: bash + run: + cat << EOF >> $GITHUB_ENV + OPENDAL_S3_REGION=auto + OPENDAL_S3_BATCH_MAX_OPERATIONS=700 + EOF diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml index 0a42c0b7c74b..27d493bc7275 100644 --- a/.github/workflows/service_test_s3.yml +++ b/.github/workflows/service_test_s3.yml @@ -71,105 +71,6 @@ jobs: OPENDAL_S3_ROLE_ARN: arn:aws:iam::952853449216:role/opendal-testing OPENDAL_S3_REGION: ap-northeast-1 - minio_s3: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup MinIO Server - shell: bash - working-directory: fixtures/s3 - run: docker-compose -f docker-compose-minio.yml up -d - - name: Setup test bucket - env: - AWS_ACCESS_KEY_ID: "minioadmin" - AWS_SECRET_ACCESS_KEY: "minioadmin" - AWS_EC2_METADATA_DISABLED: "true" - run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - name: Test - shell: bash - working-directory: core - run: cargo nextest run behavior - env: - OPENDAL_TEST: s3 - OPENDAL_S3_BUCKET: test - OPENDAL_S3_ENDPOINT: "http://127.0.0.1:9000" - OPENDAL_S3_ACCESS_KEY_ID: minioadmin - OPENDAL_S3_SECRET_ACCESS_KEY: minioadmin - OPENDAL_S3_REGION: us-east-1 - - anonymous_minio_s3: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup MinIO Server - shell: bash - working-directory: fixtures/s3 - run: | - docker-compose -f docker-compose-minio.yml up -d - - name: Setup test bucket - env: - AWS_ACCESS_KEY_ID: "minioadmin" - AWS_SECRET_ACCESS_KEY: "minioadmin" - AWS_EC2_METADATA_DISABLED: "true" - run: | - aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test - - curl -O https://dl.min.io/client/mc/release/linux-amd64/mc - chmod +x mc - ./mc alias set local http://127.0.0.1:9000/ minioadmin minioadmin - ./mc anonymous set public local/test - - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - name: Test - shell: bash - working-directory: core - run: cargo nextest run behavior - env: - OPENDAL_TEST: s3 - OPENDAL_S3_BUCKET: test - OPENDAL_S3_ENDPOINT: "http://127.0.0.1:9000" - OPENDAL_S3_ALLOW_ANONYMOUS: on - OPENDAL_S3_REGION: us-east-1 - - r2: - runs-on: ubuntu-latest - if: (github.event_name == 'push' && github.repository == 'apache/incubator-opendal') || !github.event.pull_request.head.repo.fork - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - - - name: Load secret - uses: 1password/load-secrets-action@v1 - with: - export-env: true - env: - OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - OPENDAL_S3_BUCKET: op://services/r2/bucket - OPENDAL_S3_ENDPOINT: op://services/r2/endpoint - OPENDAL_S3_ACCESS_KEY_ID: op://services/r2/access_key_id - OPENDAL_S3_SECRET_ACCESS_KEY: op://services/r2/secret_access_key - - - name: Test - shell: bash - working-directory: core - run: cargo nextest run behavior - env: - OPENDAL_TEST: s3 - OPENDAL_S3_REGION: auto - # This is the R2's limitation - # Refer to https://opendal.apache.org/docs/services/s3#compatible-services for more information - OPENDAL_S3_BATCH_MAX_OPERATIONS: 700 - java: runs-on: ubuntu-latest steps: From d3a932e9156ee01ec37b43fb6ec2da8d69e4f826 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 16:35:26 +0800 Subject: [PATCH 12/18] fix secrets Signed-off-by: Xuanwo --- .github/services/s3/aws_s3_with_assume_role/action.yml | 2 +- .github/services/s3/aws_s3_with_sse_c/action.yml | 2 +- .github/services/s3/aws_s3_with_virtual_host/action.yml | 2 +- .github/services/s3/minio_s3/action.yml | 2 +- .github/services/s3/minio_s3_with_anonymous/action.yml | 4 ++-- .github/services/s3/r2/action.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/services/s3/aws_s3_with_assume_role/action.yml b/.github/services/s3/aws_s3_with_assume_role/action.yml index db5ee5db7393..f1adaeefe83f 100644 --- a/.github/services/s3/aws_s3_with_assume_role/action.yml +++ b/.github/services/s3/aws_s3_with_assume_role/action.yml @@ -35,5 +35,5 @@ runs: - name: Add extra settings shell: bash - run: + run: | echo "OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE=on" >> $GITHUB_ENV diff --git a/.github/services/s3/aws_s3_with_sse_c/action.yml b/.github/services/s3/aws_s3_with_sse_c/action.yml index 507fc4922cb7..321b290d6a09 100644 --- a/.github/services/s3/aws_s3_with_sse_c/action.yml +++ b/.github/services/s3/aws_s3_with_sse_c/action.yml @@ -35,7 +35,7 @@ runs: - name: Add extra settings shell: bash - run: + run: | cat << EOF >> $GITHUB_ENV OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_ALGORITHM=AES256 OPENDAL_S3_SERVER_SIDE_ENCRYPTION_CUSTOMER_KEY=MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA= diff --git a/.github/services/s3/aws_s3_with_virtual_host/action.yml b/.github/services/s3/aws_s3_with_virtual_host/action.yml index 3e7e1ebf57ae..730068d1fecb 100644 --- a/.github/services/s3/aws_s3_with_virtual_host/action.yml +++ b/.github/services/s3/aws_s3_with_virtual_host/action.yml @@ -35,5 +35,5 @@ runs: - name: Add extra settings shell: bash - run: + run: | echo "OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE=on" >> $GITHUB_ENV diff --git a/.github/services/s3/minio_s3/action.yml b/.github/services/s3/minio_s3/action.yml index e74a63449b0a..bd83521adc9c 100644 --- a/.github/services/s3/minio_s3/action.yml +++ b/.github/services/s3/minio_s3/action.yml @@ -34,7 +34,7 @@ runs: run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test - name: Setup shell: bash - run: + run: | cat << EOF >> $GITHUB_ENV OPENDAL_S3_BUCKET=test OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" diff --git a/.github/services/s3/minio_s3_with_anonymous/action.yml b/.github/services/s3/minio_s3_with_anonymous/action.yml index 99308dd775e2..67ec78224ff6 100644 --- a/.github/services/s3/minio_s3_with_anonymous/action.yml +++ b/.github/services/s3/minio_s3_with_anonymous/action.yml @@ -41,8 +41,8 @@ runs: ./mc anonymous set public local/test - name: Setup shell: bash - run: - cat << EOF >> $GITHUB_ENV + run: | + cat << EOF >> /tmp/x OPENDAL_S3_BUCKET=test OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" OPENDAL_S3_REGION=us-east-1 diff --git a/.github/services/s3/r2/action.yml b/.github/services/s3/r2/action.yml index cfbd1e4fd549..38b85141f6c6 100644 --- a/.github/services/s3/r2/action.yml +++ b/.github/services/s3/r2/action.yml @@ -35,7 +35,7 @@ runs: # Refer to https://opendal.apache.org/docs/services/s3#compatible-services for more information - name: Add extra settings shell: bash - run: + run: | cat << EOF >> $GITHUB_ENV OPENDAL_S3_REGION=auto OPENDAL_S3_BATCH_MAX_OPERATIONS=700 From a5796243ef2d276caaa0f20ca5537c4a93ba5c88 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 16:46:20 +0800 Subject: [PATCH 13/18] Fix typo Signed-off-by: Xuanwo --- .github/actions/behavior_test_core/action.yaml | 5 ----- .github/services/s3/minio_s3_with_anonymous/action.yml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/actions/behavior_test_core/action.yaml b/.github/actions/behavior_test_core/action.yaml index 2447ac920a81..0aed1609c8d7 100644 --- a/.github/actions/behavior_test_core/action.yaml +++ b/.github/actions/behavior_test_core/action.yaml @@ -22,9 +22,6 @@ inputs: description: "The setup action for test" service: description: "The service to test" - secrets: - description: "The secrets for test" - default: "{}" runs: using: "composite" @@ -39,8 +36,6 @@ runs: steps: - name: Setup Test Core uses: ./.github/services/${{ inputs.service }}/${{ inputs.setup }} - with: - secrets: ${{ toJson(inputs.secrets) }} - name: Run Test Core shell: bash working-directory: core diff --git a/.github/services/s3/minio_s3_with_anonymous/action.yml b/.github/services/s3/minio_s3_with_anonymous/action.yml index 67ec78224ff6..ac267d2de7f4 100644 --- a/.github/services/s3/minio_s3_with_anonymous/action.yml +++ b/.github/services/s3/minio_s3_with_anonymous/action.yml @@ -42,7 +42,7 @@ runs: - name: Setup shell: bash run: | - cat << EOF >> /tmp/x + cat << EOF >> $GITHUB_ENV OPENDAL_S3_BUCKET=test OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" OPENDAL_S3_REGION=us-east-1 From a3d1e669cefa64dd4fd1c03834b5d7e4be88b9e8 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 16:53:57 +0800 Subject: [PATCH 14/18] Fix endpoint Signed-off-by: Xuanwo --- .../s3/aws_s3_with_assume_role/action.yml | 39 ------------------- .github/services/s3/minio_s3/action.yml | 2 +- .../s3/minio_s3_with_anonymous/action.yml | 2 +- 3 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 .github/services/s3/aws_s3_with_assume_role/action.yml diff --git a/.github/services/s3/aws_s3_with_assume_role/action.yml b/.github/services/s3/aws_s3_with_assume_role/action.yml deleted file mode 100644 index f1adaeefe83f..000000000000 --- a/.github/services/s3/aws_s3_with_assume_role/action.yml +++ /dev/null @@ -1,39 +0,0 @@ -# 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: aws_s3_with_assume_role -description: 'Behavior test for AWS S3 with assume role. This service is sponsored by @datafuse_labs.' - -runs: - using: "composite" - steps: - - name: Setup - uses: 1password/load-secrets-action@v1 - with: - export-env: true - env: - OPENDAL_S3_ROOT: op://services/s3/root - OPENDAL_S3_BUCKET: op://services/s3/bucket - OPENDAL_S3_ENDPOINT: op://services/s3/endpoint - OPENDAL_S3_ACCESS_KEY_ID: op://services/s3/access_key_id - OPENDAL_S3_SECRET_ACCESS_KEY: op://services/s3/secret_access_key - OPENDAL_S3_REGION: op://services/s3/region - - - name: Add extra settings - shell: bash - run: | - echo "OPENDAL_S3_ENABLE_VIRTUAL_HOST_STYLE=on" >> $GITHUB_ENV diff --git a/.github/services/s3/minio_s3/action.yml b/.github/services/s3/minio_s3/action.yml index bd83521adc9c..ed237bb37c54 100644 --- a/.github/services/s3/minio_s3/action.yml +++ b/.github/services/s3/minio_s3/action.yml @@ -37,7 +37,7 @@ runs: run: | cat << EOF >> $GITHUB_ENV OPENDAL_S3_BUCKET=test - OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" + OPENDAL_S3_ENDPOINT=http://127.0.0.1:9000 OPENDAL_S3_ACCESS_KEY_ID=minioadmin OPENDAL_S3_SECRET_ACCESS_KEY=minioadmin OPENDAL_S3_REGION=us-east-1 diff --git a/.github/services/s3/minio_s3_with_anonymous/action.yml b/.github/services/s3/minio_s3_with_anonymous/action.yml index ac267d2de7f4..407289d9c3c2 100644 --- a/.github/services/s3/minio_s3_with_anonymous/action.yml +++ b/.github/services/s3/minio_s3_with_anonymous/action.yml @@ -44,7 +44,7 @@ runs: run: | cat << EOF >> $GITHUB_ENV OPENDAL_S3_BUCKET=test - OPENDAL_S3_ENDPOINT="http://127.0.0.1:9000" + OPENDAL_S3_ENDPOINT=http://127.0.0.1:9000 OPENDAL_S3_REGION=us-east-1 OPENDAL_S3_ALLOW_ANONYMOUS=on EOF From 715875dd98f221f6388b04dba1280f473b60ef07 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 17:09:32 +0800 Subject: [PATCH 15/18] Test directly Signed-off-by: Xuanwo --- .../actions/behavior_test_core/action.yaml | 4 +- .github/scripts/behavior_test/plan.py | 15 ++++--- .github/scripts/behavior_test/test_plan.py | 6 ++- .github/workflows/behavior_test_core.yml | 44 ++----------------- 4 files changed, 20 insertions(+), 49 deletions(-) diff --git a/.github/actions/behavior_test_core/action.yaml b/.github/actions/behavior_test_core/action.yaml index 0aed1609c8d7..ca27b8d3f55d 100644 --- a/.github/actions/behavior_test_core/action.yaml +++ b/.github/actions/behavior_test_core/action.yaml @@ -22,6 +22,8 @@ inputs: description: "The setup action for test" service: description: "The service to test" + feature: + description: "The feature to test" runs: using: "composite" @@ -39,7 +41,7 @@ runs: - name: Run Test Core shell: bash working-directory: core - run: cargo nextest run behavior --archive-file=./test-core.tar.zst + run: cargo nextest run behavior --features ${{ inputs.feature }} env: OPENDAL_TEST: ${{ inputs.service }} EOF diff --git a/.github/scripts/behavior_test/plan.py b/.github/scripts/behavior_test/plan.py index e1fd25ff3f98..e74c674fdec1 100755 --- a/.github/scripts/behavior_test/plan.py +++ b/.github/scripts/behavior_test/plan.py @@ -98,11 +98,13 @@ def plan(changed_files): jobs["core"] = [ { "os": "ubuntu-latest", - "features": ",".join( - set([f"services-{v['service']}" for v in core_cases]) - ), "cases": [ - {"setup": v["setup"], "service": v["service"]} for v in core_cases + { + "setup": v["setup"], + "service": v["service"], + "feature": "services-{}".format(v["service"].replace("_", "-")), + } + for v in core_cases ], }, ] @@ -112,8 +114,9 @@ def plan(changed_files): jobs["core"].append( { "os": "windows-latest", - "features": "services-fs", - "cases": [{"setup": "local-fs", "service": "fs"}], + "cases": [ + {"setup": "local-fs", "service": "fs", "feature": "services-fs"} + ], } ) diff --git a/.github/scripts/behavior_test/test_plan.py b/.github/scripts/behavior_test/test_plan.py index d023095ff986..090a56d14788 100644 --- a/.github/scripts/behavior_test/test_plan.py +++ b/.github/scripts/behavior_test/test_plan.py @@ -32,10 +32,12 @@ def test_core_services_fs(self): result = plan(["core/src/services/fs/mod.rs"]) self.assertTrue(result["components"]["core"]) self.assertTrue(len(result["core"]) > 0) + + cases = [v["service"] for v in result["core"][0]["cases"]] # Should not contain fs - self.assertTrue("services-fs" in result["core"][0]["features"]) + self.assertTrue("fs" in cases) # Should not contain s3 - self.assertFalse("services-s3" in result["core"][0]["features"]) + self.assertFalse("s3" in cases) if __name__ == "__main__": diff --git a/.github/workflows/behavior_test_core.yml b/.github/workflows/behavior_test_core.yml index 748f5ba341ef..71e7f4db9dbb 100644 --- a/.github/workflows/behavior_test_core.yml +++ b/.github/workflows/behavior_test_core.yml @@ -31,39 +31,6 @@ on: type: string jobs: - build: - name: build - runs-on: ${{ inputs.os }} - steps: - - uses: actions/checkout@v4 - - - name: Setup Rust toolchain - uses: ./.github/actions/setup - with: - need-nextest: true - need-protoc: true - need-rocksdb: true - github-token: ${{ secrets.GITHUB_TOKEN }} - - # Required by hdfs - - name: Setup java env - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: "11" - - - name: Build - shell: bash - working-directory: core - run: | - cargo nextest archive --features ${{ inputs.features }} --archive-file ./test-core.tar.zst - - - name: Upload - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.os }}-test-core - path: ./core/test-core.tar.zst - test: name: ${{ matrix.cases.service }} / ${{ matrix.cases.setup }} needs: [build] @@ -81,13 +48,9 @@ jobs: need-rocksdb: true github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Download - uses: actions/download-artifact@v3 - with: - name: ${{ inputs.os }}-test-core - path: ./core - - # TODO: 1password is only supported on linux, waiting for https://github.com/1Password/load-secrets-action/issues/46 + # TODO: 1password is only supported on linux + # + # Waiting for https://github.com/1Password/load-secrets-action/issues/46 - name: Setup service account token for 1password if: runner.os == 'Linux' shell: bash @@ -98,3 +61,4 @@ jobs: with: setup: ${{ matrix.cases.setup }} service: ${{ matrix.cases.service }} + feature: ${{ matrix.cases.feature }} From f5bfe901c3518393b61b9f3cfa4e168b725868ee Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 17:10:51 +0800 Subject: [PATCH 16/18] Fix plan Signed-off-by: Xuanwo --- .github/scripts/behavior_test/plan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/behavior_test/plan.py b/.github/scripts/behavior_test/plan.py index e74c674fdec1..9040d1a60238 100755 --- a/.github/scripts/behavior_test/plan.py +++ b/.github/scripts/behavior_test/plan.py @@ -115,7 +115,7 @@ def plan(changed_files): { "os": "windows-latest", "cases": [ - {"setup": "local-fs", "service": "fs", "feature": "services-fs"} + {"setup": "local_fs", "service": "fs", "feature": "services-fs"} ], } ) From 1bd51c8e0d13259a0ba00bde568c30f3dc822eee Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 17:12:08 +0800 Subject: [PATCH 17/18] remove needs Signed-off-by: Xuanwo --- .github/workflows/behavior_test_core.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/behavior_test_core.yml b/.github/workflows/behavior_test_core.yml index 71e7f4db9dbb..3d8c016dda32 100644 --- a/.github/workflows/behavior_test_core.yml +++ b/.github/workflows/behavior_test_core.yml @@ -33,7 +33,6 @@ on: jobs: test: name: ${{ matrix.cases.service }} / ${{ matrix.cases.setup }} - needs: [build] runs-on: ${{ inputs.os }} strategy: matrix: From 85e8b6c3d624c578ca1641ef62655c3596f1bbc0 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Wed, 18 Oct 2023 17:12:36 +0800 Subject: [PATCH 18/18] Remove features Signed-off-by: Xuanwo --- .github/workflows/behavior_test.yml | 1 - .github/workflows/behavior_test_core.yml | 3 --- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index 838b605ab3db..a4b2b240d22e 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -89,4 +89,3 @@ jobs: with: os: ${{ matrix.os }} cases: ${{ toJson(matrix.cases) }} - features: ${{ matrix.features }} diff --git a/.github/workflows/behavior_test_core.yml b/.github/workflows/behavior_test_core.yml index 3d8c016dda32..344fe62d743c 100644 --- a/.github/workflows/behavior_test_core.yml +++ b/.github/workflows/behavior_test_core.yml @@ -26,9 +26,6 @@ on: cases: required: true type: string - features: - required: true - type: string jobs: test: