From 7ad8ba652e2b04837ad5f1b9ad4ca16f489f4432 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Fri, 3 Nov 2023 16:56:31 -0400 Subject: [PATCH 01/18] chore: add openstack swift into .env.example --- .env.example | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.env.example b/.env.example index f84d0bec6287..e57e121c743b 100644 --- a/.env.example +++ b/.env.example @@ -155,3 +155,9 @@ OPENDAL_AZFILE_ROOT=/tmp/opendal/ OPENDAL_AZFILE_ACCOUNT_NAME= OPENDAL_AZFILE_ACCOUNT_KEY= OPENDAL_AZFILE_SHARE_NAME= +# openstack swift +OPENDAL_SWIFT_ENDPOINT= +OPENDAL_SWIFT_ACCOUNT= +OPENDAL_SWIFT_CONTAINER= +OPENDAL_SWIFT_ROOT=/path/to/dir +OPENDAL_SWIFT_TOKEN= From 615c3488af87ec8e7731715018d11d0120ec3b59 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Sat, 4 Nov 2023 20:49:43 -0400 Subject: [PATCH 02/18] feat: add openstack swift e2e test --- .github/services/swift/swift/action.yml | 47 +++++++++++++++++++++++++ .github/workflows/ci.yml | 1 + bindings/java/Cargo.toml | 2 ++ bindings/nodejs/Cargo.toml | 2 ++ bindings/python/Cargo.toml | 2 ++ fixtures/swift/docker-compose-swift.yml | 29 +++++++++++++++ 6 files changed, 83 insertions(+) create mode 100644 .github/services/swift/swift/action.yml create mode 100644 fixtures/swift/docker-compose-swift.yml diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml new file mode 100644 index 000000000000..17baa836d168 --- /dev/null +++ b/.github/services/swift/swift/action.yml @@ -0,0 +1,47 @@ +# 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: swift +description: "Behavior test for OpenStack Swift" + +runs: + using: "composite" + steps: + - name: Setup Swift service + shell: bash + working-directory: fixtures/swift + run: docker compose -f docker-compose-swift.yml up -d --wait + - name: create test token + shell: bash + run: | + token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') + echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV + - name: Setup test container + shell: bash + run: | + curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $OPENDAL_SWIFT_TOKEN" + - name: Setup + shell: bash + run: | + cat << EOF >> $GITHUB_ENV + RUST_BACKTRACE=full + RUST_LOG=debug + OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 + OPENDAL_SWIFT_ACCOUNT=AUTH_test + OPENDAL_SWIFT_CONTAINER=testing + OPENDAL_SWIFT_ROOT=test:tester + EOF diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79fc2bd0acd2..de199f5d3d3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -238,6 +238,7 @@ jobs: # TODO: sftp is known to not work on windows, waiting for https://github.com/apache/incubator-opendal/issues/2963 # services-sftp services-sled + services-swift services-supabase services-tikv services-vercel-artifacts diff --git a/bindings/java/Cargo.toml b/bindings/java/Cargo.toml index 87c7ca2c771d..b21fc2fd72d1 100644 --- a/bindings/java/Cargo.toml +++ b/bindings/java/Cargo.toml @@ -83,6 +83,7 @@ services-all = [ "services-sqlite", "services-azfile", "services-libsql", + "services-swift", ] # Default services provided by opendal. @@ -131,6 +132,7 @@ services-tikv = ["opendal/services-tikv"] services-vercel-artifacts = ["opendal/services-vercel-artifacts"] services-wasabi = ["opendal/services-wasabi"] services-libsql = ["opendal/services-libsql"] +services-swift = ["opendal/services-swift"] [dependencies] diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml index 4460e782617d..a8294b33aa89 100644 --- a/bindings/nodejs/Cargo.toml +++ b/bindings/nodejs/Cargo.toml @@ -73,6 +73,7 @@ services-all = [ "services-rocksdb", "services-sled", "services-supabase", + "services-swift", "services-tikv", "services-vercel-artifacts", "services-wasabi", @@ -123,6 +124,7 @@ services-sftp = ["opendal/services-sftp"] services-sled = ["opendal/services-sled"] services-sqlite = ["opendal/services-sqlite"] services-supabase = ["opendal/services-supabase"] +services-swift = ["opendal/services-swift"] services-tikv = ["opendal/services-tikv"] services-vercel-artifacts = ["opendal/services-vercel-artifacts"] services-wasabi = ["opendal/services-wasabi"] diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml index 7ace6adb41bc..dca2c5b18729 100644 --- a/bindings/python/Cargo.toml +++ b/bindings/python/Cargo.toml @@ -73,6 +73,7 @@ services-all = [ "services-rocksdb", "services-sled", "services-supabase", + "services-swift", "services-tikv", "services-vercel-artifacts", "services-wasabi", @@ -123,6 +124,7 @@ services-sftp = ["opendal/services-sftp"] services-sled = ["opendal/services-sled"] services-sqlite = ["opendal/services-sqlite"] services-supabase = ["opendal/services-supabase"] +services-swift = ["opendal/services-swift"] services-tikv = ["opendal/services-tikv"] services-vercel-artifacts = ["opendal/services-vercel-artifacts"] services-wasabi = ["opendal/services-wasabi"] diff --git a/fixtures/swift/docker-compose-swift.yml b/fixtures/swift/docker-compose-swift.yml new file mode 100644 index 000000000000..1f4cf949b72f --- /dev/null +++ b/fixtures/swift/docker-compose-swift.yml @@ -0,0 +1,29 @@ +# 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. + +version: '3.8' + +services: + swift: + image: openstackswift/saio:py3 + ports: + - 8080:8080 + healthcheck: + test: ["CMD", "curl", "-i", "-H", "X-Storage-User: test:tester", "-H", "X-Storage-Pass: testing", "http://localhost:8080/"] + interval: 2s + timeout: 20s + retries: 10 From c00bb979e03c8b541dfe191090c22caf8b572b4c Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Sun, 5 Nov 2023 02:27:44 -0500 Subject: [PATCH 03/18] feat: drop rename as swift doesn't support it --- core/src/services/swift/backend.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/services/swift/backend.rs b/core/src/services/swift/backend.rs index 1bfc4124caa1..080b525c1dae 100644 --- a/core/src/services/swift/backend.rs +++ b/core/src/services/swift/backend.rs @@ -235,7 +235,6 @@ impl Accessor for SwiftBackend { write: true, create_dir: true, delete: true, - rename: true, list: true, list_with_delimiter_slash: true, From 1083ce05e129090e0eaa989aad0ae8659cb84720 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Sun, 5 Nov 2023 22:25:04 -0500 Subject: [PATCH 04/18] fix: correct OPENDAL_SWIFT_ROOT value --- .github/services/swift/swift/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 17baa836d168..61ac57f92d5d 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -43,5 +43,5 @@ runs: OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 OPENDAL_SWIFT_ACCOUNT=AUTH_test OPENDAL_SWIFT_CONTAINER=testing - OPENDAL_SWIFT_ROOT=test:tester + OPENDAL_SWIFT_ROOT=/ EOF From 4c63f7ccefb7da75d5a7c82899c5d2b832a9825a Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 01:05:55 -0500 Subject: [PATCH 05/18] chore: use another way to export env variables --- .github/services/swift/swift/action.yml | 26 ++++++++++++------------- fixtures/swift/docker-compose-swift.yml | 6 +++--- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 61ac57f92d5d..e540e3c97afd 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -24,24 +24,22 @@ runs: - name: Setup Swift service shell: bash working-directory: fixtures/swift - run: docker compose -f docker-compose-swift.yml up -d --wait - - name: create test token + run: | + docker compose -f docker-compose-swift.yml up -d --wait + + - name: Create test token and setup test container shell: bash run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV - - name: Setup test container - shell: bash - run: | curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $OPENDAL_SWIFT_TOKEN" - - name: Setup + + - name: Setup environment variables shell: bash run: | - cat << EOF >> $GITHUB_ENV - RUST_BACKTRACE=full - RUST_LOG=debug - OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 - OPENDAL_SWIFT_ACCOUNT=AUTH_test - OPENDAL_SWIFT_CONTAINER=testing - OPENDAL_SWIFT_ROOT=/ - EOF + echo "RUST_BACKTRACE=full" >> $GITHUB_ENV + echo "RUST_LOG=debug" >> $GITHUB_ENV + echo "OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080" >> $GITHUB_ENV + echo "OPENDAL_SWIFT_ACCOUNT=AUTH_test" >> $GITHUB_ENV + echo "OPENDAL_SWIFT_CONTAINER=testing" >> $GITHUB_ENV + echo "OPENDAL_SWIFT_ROOT=/" >> $GITHUB_ENV diff --git a/fixtures/swift/docker-compose-swift.yml b/fixtures/swift/docker-compose-swift.yml index 1f4cf949b72f..f3059b276898 100644 --- a/fixtures/swift/docker-compose-swift.yml +++ b/fixtures/swift/docker-compose-swift.yml @@ -24,6 +24,6 @@ services: - 8080:8080 healthcheck: test: ["CMD", "curl", "-i", "-H", "X-Storage-User: test:tester", "-H", "X-Storage-Pass: testing", "http://localhost:8080/"] - interval: 2s - timeout: 20s - retries: 10 + interval: 3s + timeout: 5s + retries: 5 From 875ce7c52a51c821d0e503493920fc94285b781f Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 01:56:06 -0500 Subject: [PATCH 06/18] tmp: add debug log --- .github/services/swift/swift/action.yml | 12 ++-- .github/workflows/behavior_test.yml | 76 ++++++++++++------------- .github/workflows/ci.yml | 68 +++++++++++----------- core/src/services/swift/core.rs | 1 + 4 files changed, 79 insertions(+), 78 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index e540e3c97afd..f9ef79eddb6b 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -37,9 +37,9 @@ runs: - name: Setup environment variables shell: bash run: | - echo "RUST_BACKTRACE=full" >> $GITHUB_ENV - echo "RUST_LOG=debug" >> $GITHUB_ENV - echo "OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080" >> $GITHUB_ENV - echo "OPENDAL_SWIFT_ACCOUNT=AUTH_test" >> $GITHUB_ENV - echo "OPENDAL_SWIFT_CONTAINER=testing" >> $GITHUB_ENV - echo "OPENDAL_SWIFT_ROOT=/" >> $GITHUB_ENV + cat << EOF >> $GITHUB_ENV + OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 + OPENDAL_SWIFT_ACCOUNT=AUTH_test + OPENDAL_SWIFT_CONTAINER=testing + OPENDAL_SWIFT_ROOT=/ + EOF diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index 2bc761b235f1..cf4ddd97a241 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -90,41 +90,41 @@ jobs: os: ${{ matrix.os }} cases: ${{ toJson(matrix.cases) }} - test_binding_java: - name: binding_java / ${{ matrix.os }} - needs: [plan] - if: fromJson(needs.plan.outputs.plan).components.binding_java - secrets: inherit - strategy: - matrix: - include: ${{ fromJson(needs.plan.outputs.plan).binding_java }} - uses: ./.github/workflows/behavior_test_binding_java.yml - with: - os: ${{ matrix.os }} - cases: ${{ toJson(matrix.cases) }} - - test_binding_python: - name: binding_python / ${{ matrix.os }} - needs: [plan] - if: fromJson(needs.plan.outputs.plan).components.binding_python - secrets: inherit - strategy: - matrix: - include: ${{ fromJson(needs.plan.outputs.plan).binding_python }} - uses: ./.github/workflows/behavior_test_binding_python.yml - with: - os: ${{ matrix.os }} - cases: ${{ toJson(matrix.cases) }} - - test_binding_nodejs: - name: binding_nodejs / ${{ matrix.os }} - needs: [plan] - if: fromJson(needs.plan.outputs.plan).components.binding_nodejs - secrets: inherit - strategy: - matrix: - include: ${{ fromJson(needs.plan.outputs.plan).binding_nodejs }} - uses: ./.github/workflows/behavior_test_binding_nodejs.yml - with: - os: ${{ matrix.os }} - cases: ${{ toJson(matrix.cases) }} +# test_binding_java: +# name: binding_java / ${{ matrix.os }} +# needs: [plan] +# if: fromJson(needs.plan.outputs.plan).components.binding_java +# secrets: inherit +# strategy: +# matrix: +# include: ${{ fromJson(needs.plan.outputs.plan).binding_java }} +# uses: ./.github/workflows/behavior_test_binding_java.yml +# with: +# os: ${{ matrix.os }} +# cases: ${{ toJson(matrix.cases) }} +# +# test_binding_python: +# name: binding_python / ${{ matrix.os }} +# needs: [plan] +# if: fromJson(needs.plan.outputs.plan).components.binding_python +# secrets: inherit +# strategy: +# matrix: +# include: ${{ fromJson(needs.plan.outputs.plan).binding_python }} +# uses: ./.github/workflows/behavior_test_binding_python.yml +# with: +# os: ${{ matrix.os }} +# cases: ${{ toJson(matrix.cases) }} +# +# test_binding_nodejs: +# name: binding_nodejs / ${{ matrix.os }} +# needs: [plan] +# if: fromJson(needs.plan.outputs.plan).components.binding_nodejs +# secrets: inherit +# strategy: +# matrix: +# include: ${{ fromJson(needs.plan.outputs.plan).binding_nodejs }} +# uses: ./.github/workflows/behavior_test_binding_nodejs.yml +# with: +# os: ${{ matrix.os }} +# cases: ${{ toJson(matrix.cases) }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de199f5d3d3b..70ec135bf848 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,49 +202,49 @@ jobs: shell: bash run: | FEATURES=( - services-azblob - services-azdls - services-cacache - services-cos - services-dashmap - services-dropbox - services-etcd + # services-azblob + # services-azdls + # services-cacache + # services-cos + # services-dashmap + # services-dropbox + # services-etcd # FIXME this requires a preinstalled fdb library # services-foundationdb - services-fs - services-ftp - services-gcs - services-gdrive - services-ghac + # services-fs + # services-ftp + # services-gcs + # services-gdrive + # services-ghac # FIXME how to support HDFS services in other platforms? # services-hdfs - services-http - services-ipfs - services-ipmfs - services-memcached - services-memory - services-mini-moka - services-moka - services-obs - services-onedrive - services-oss - services-persy - services-postgresql - services-redb - services-redis + # services-http + # services-ipfs + # services-ipmfs + # services-memcached + # services-memory + # services-mini-moka + # services-moka + # services-obs + # services-onedrive + # services-oss + # services-persy + # services-postgresql + # services-redb + # services-redis # TODO: we need to find ways to using pre-install rocksdb library # services-rocksdb - services-s3 + # services-s3 # TODO: sftp is known to not work on windows, waiting for https://github.com/apache/incubator-opendal/issues/2963 # services-sftp - services-sled + # services-sled services-swift - services-supabase - services-tikv - services-vercel-artifacts - services-wasabi - services-webdav - services-webhdfs + # services-supabase + # services-tikv + # services-vercel-artifacts + # services-wasabi + # services-webdav + # services-webhdfs ) cargo build --features "${FEATURES[*]}" diff --git a/core/src/services/swift/core.rs b/core/src/services/swift/core.rs index 3412bbd8e8e1..06d7d9fc63e1 100644 --- a/core/src/services/swift/core.rs +++ b/core/src/services/swift/core.rs @@ -58,6 +58,7 @@ impl SwiftCore { let mut req = Request::delete(&url); req = req.header("X-Auth-Token", &self.token); + eprintln!("X-Auth-Token: {}", &self.token); let body = AsyncBody::Empty; From 6cd67a224ff1c07403f59f5526bd42267f791daf Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 10:58:28 -0500 Subject: [PATCH 07/18] chore: modify timout and retries values --- fixtures/swift/docker-compose-swift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fixtures/swift/docker-compose-swift.yml b/fixtures/swift/docker-compose-swift.yml index f3059b276898..02b83572b852 100644 --- a/fixtures/swift/docker-compose-swift.yml +++ b/fixtures/swift/docker-compose-swift.yml @@ -25,5 +25,5 @@ services: healthcheck: test: ["CMD", "curl", "-i", "-H", "X-Storage-User: test:tester", "-H", "X-Storage-Pass: testing", "http://localhost:8080/"] interval: 3s - timeout: 5s - retries: 5 + timeout: 20s + retries: 10 \ No newline at end of file From 7804dbf0eadd6f4ebcfb153bcc912a1ffc12338f Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 12:33:49 -0500 Subject: [PATCH 08/18] fix: adding tr -d '\n' to fix weird bug --- .github/services/swift/swift/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index f9ef79eddb6b..44c37a660ab8 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -30,7 +30,7 @@ runs: - name: Create test token and setup test container shell: bash run: | - token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') + token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}' | tr -d '\n') echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $OPENDAL_SWIFT_TOKEN" From bb83f4015f8bf8af3d7ff22895aef228ae79d2a5 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 13:17:10 -0500 Subject: [PATCH 09/18] chore: add trim_end to token as triage weird bug --- core/src/services/swift/core.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/src/services/swift/core.rs b/core/src/services/swift/core.rs index 06d7d9fc63e1..8fac52b2195c 100644 --- a/core/src/services/swift/core.rs +++ b/core/src/services/swift/core.rs @@ -57,8 +57,7 @@ impl SwiftCore { let mut req = Request::delete(&url); - req = req.header("X-Auth-Token", &self.token); - eprintln!("X-Auth-Token: {}", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); let body = AsyncBody::Empty; @@ -87,7 +86,7 @@ impl SwiftCore { let mut req = Request::get(&url); - req = req.header("X-Auth-Token", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); let req = req .body(AsyncBody::Empty) @@ -113,7 +112,7 @@ impl SwiftCore { let mut req = Request::put(&url); - req = req.header("X-Auth-Token", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); if p.ends_with('/') { req = req.header("Content-Length", "0"); @@ -141,7 +140,7 @@ impl SwiftCore { let mut req = Request::get(&url); - req = req.header("X-Auth-Token", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); if !range.is_full() { req = req.header("Range", &range.to_header()); @@ -183,7 +182,7 @@ impl SwiftCore { // Reference: https://docs.openstack.org/api-ref/object-store/#copy-object let mut req = Request::put(&url); - req = req.header("X-Auth-Token", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); req = req.header("X-Copy-From", percent_encode_path(&src_p)); // if use PUT method, we need to set the content-length to 0. @@ -209,7 +208,7 @@ impl SwiftCore { let mut req = Request::head(&url); - req = req.header("X-Auth-Token", &self.token); + req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); let req = req .body(AsyncBody::Empty) From e5f89abc4cb4f98765fde431a777e045a53c3544 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 13:49:07 -0500 Subject: [PATCH 10/18] chore: don't use token from GITHUB_ENV --- .github/services/swift/swift/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 44c37a660ab8..e7f628b3755f 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -32,7 +32,7 @@ runs: run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}' | tr -d '\n') echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV - curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $OPENDAL_SWIFT_TOKEN" + curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - name: Setup environment variables shell: bash From 7b2053f7d036847255a33ee28762353242906af9 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 14:42:22 -0500 Subject: [PATCH 11/18] feat: export env variable at once --- .github/services/swift/swift/action.yml | 5 +++-- core/src/services/swift/core.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index e7f628b3755f..414ee19c110a 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -30,8 +30,8 @@ runs: - name: Create test token and setup test container shell: bash run: | - token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}' | tr -d '\n') - echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV + token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') + # echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - name: Setup environment variables @@ -42,4 +42,5 @@ runs: OPENDAL_SWIFT_ACCOUNT=AUTH_test OPENDAL_SWIFT_CONTAINER=testing OPENDAL_SWIFT_ROOT=/ + OPENDAL_SWIFT_TOKEN=$token EOF diff --git a/core/src/services/swift/core.rs b/core/src/services/swift/core.rs index 8fac52b2195c..3412bbd8e8e1 100644 --- a/core/src/services/swift/core.rs +++ b/core/src/services/swift/core.rs @@ -57,7 +57,7 @@ impl SwiftCore { let mut req = Request::delete(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); let body = AsyncBody::Empty; @@ -86,7 +86,7 @@ impl SwiftCore { let mut req = Request::get(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); let req = req .body(AsyncBody::Empty) @@ -112,7 +112,7 @@ impl SwiftCore { let mut req = Request::put(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); if p.ends_with('/') { req = req.header("Content-Length", "0"); @@ -140,7 +140,7 @@ impl SwiftCore { let mut req = Request::get(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); if !range.is_full() { req = req.header("Range", &range.to_header()); @@ -182,7 +182,7 @@ impl SwiftCore { // Reference: https://docs.openstack.org/api-ref/object-store/#copy-object let mut req = Request::put(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); req = req.header("X-Copy-From", percent_encode_path(&src_p)); // if use PUT method, we need to set the content-length to 0. @@ -208,7 +208,7 @@ impl SwiftCore { let mut req = Request::head(&url); - req = req.header("X-Auth-Token", &self.token.trim_end().to_string()); + req = req.header("X-Auth-Token", &self.token); let req = req .body(AsyncBody::Empty) From 705e330077579782040b0d85b87d485efd4187e3 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 14:54:55 -0500 Subject: [PATCH 12/18] chore: use different format to export env variable --- .github/services/swift/swift/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 414ee19c110a..483ba827e81f 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -31,7 +31,7 @@ runs: shell: bash run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') - # echo "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV + echo "OPENDAL_SWIFT_TOKEN=${{ token }}" >> $GITHUB_ENV curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - name: Setup environment variables @@ -42,5 +42,4 @@ runs: OPENDAL_SWIFT_ACCOUNT=AUTH_test OPENDAL_SWIFT_CONTAINER=testing OPENDAL_SWIFT_ROOT=/ - OPENDAL_SWIFT_TOKEN=$token EOF From f12247f8397a64384130a60ccec1589fe85c56a7 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 15:06:35 -0500 Subject: [PATCH 13/18] chore: use echo -e to enable backslash escapes. --- .github/services/swift/swift/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 483ba827e81f..685d8717519e 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -31,8 +31,8 @@ runs: shell: bash run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') - echo "OPENDAL_SWIFT_TOKEN=${{ token }}" >> $GITHUB_ENV curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" + echo -e "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV - name: Setup environment variables shell: bash From 8f17650ff6446c1ee6447b27b09ff64275487615 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 15:29:13 -0500 Subject: [PATCH 14/18] chore: use cat EOF to set token --- .github/services/swift/swift/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 685d8717519e..6fe03e146d24 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -32,7 +32,9 @@ runs: run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - echo -e "OPENDAL_SWIFT_TOKEN=$token" >> $GITHUB_ENV + cat << EOF >> $GITHUB_ENV + OPENDAL_SWIFT_TOKEN=$token + EOF - name: Setup environment variables shell: bash From 355c696bcd48bc481e7f775ebdca8080cbd98cb8 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 16:15:15 -0500 Subject: [PATCH 15/18] chore: workaround by pre-apply token and trim end --- .github/services/swift/swift/action.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 6fe03e146d24..77e15ddaf23a 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -32,9 +32,8 @@ runs: run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - cat << EOF >> $GITHUB_ENV - OPENDAL_SWIFT_TOKEN=$token - EOF + token_var="OPENDAL_SWIFT_TOKEN=$token" + echo $(echo "$token_var" | tr -d '\n') >> $GITHUB_ENV - name: Setup environment variables shell: bash From ece2385c6bc08fffd51965e89bc07eec10330748 Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 16:22:27 -0500 Subject: [PATCH 16/18] chore: triage by merge two steps together --- .github/services/swift/swift/action.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index 77e15ddaf23a..b22c24b1ef69 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -32,15 +32,11 @@ runs: run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" - token_var="OPENDAL_SWIFT_TOKEN=$token" - echo $(echo "$token_var" | tr -d '\n') >> $GITHUB_ENV - - name: Setup environment variables - shell: bash - run: | - cat << EOF >> $GITHUB_ENV - OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 - OPENDAL_SWIFT_ACCOUNT=AUTH_test - OPENDAL_SWIFT_CONTAINER=testing - OPENDAL_SWIFT_ROOT=/ - EOF + cat << EOF >> $GITHUB_ENV + OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 + OPENDAL_SWIFT_ACCOUNT=AUTH_test + OPENDAL_SWIFT_CONTAINER=testing + OPENDAL_SWIFT_ROOT=/ + OPENDAL_SWIFT_TOKEN=$(echo "$token" | tr -d '[:space:]') + EOF From 44e899030b8cf8e306d248501b6f50eaf8871b0f Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 16:57:14 -0500 Subject: [PATCH 17/18] chore: prune and separate steps --- .github/services/swift/swift/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml index b22c24b1ef69..397eba16addf 100644 --- a/.github/services/swift/swift/action.yml +++ b/.github/services/swift/swift/action.yml @@ -32,11 +32,14 @@ runs: run: | token=$(curl -i -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 | grep X-Auth-Token | head -n1 | awk '{print $2}') curl --location --request PUT 'http://127.0.0.1:8080/v1/AUTH_test/testing' --header "X-Auth-Token: $token" + echo "OPENDAL_SWIFT_TOKEN=$(echo "$token" | tr -d '[:space:]')" >> $GITHUB_ENV + - name: Set environment variables + shell: bash + run: | cat << EOF >> $GITHUB_ENV OPENDAL_SWIFT_ENDPOINT=http://127.0.0.1:8080 OPENDAL_SWIFT_ACCOUNT=AUTH_test OPENDAL_SWIFT_CONTAINER=testing OPENDAL_SWIFT_ROOT=/ - OPENDAL_SWIFT_TOKEN=$(echo "$token" | tr -d '[:space:]') EOF From 22871e7b20525c009ed88805484a0d6f700ae78d Mon Sep 17 00:00:00 2001 From: Morris Tai Date: Mon, 6 Nov 2023 17:13:03 -0500 Subject: [PATCH 18/18] chore: reset comment out for debug purpose --- .github/workflows/behavior_test.yml | 76 ++++++++++++++--------------- .github/workflows/ci.yml | 68 +++++++++++++------------- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/.github/workflows/behavior_test.yml b/.github/workflows/behavior_test.yml index cf4ddd97a241..2bc761b235f1 100644 --- a/.github/workflows/behavior_test.yml +++ b/.github/workflows/behavior_test.yml @@ -90,41 +90,41 @@ jobs: os: ${{ matrix.os }} cases: ${{ toJson(matrix.cases) }} -# test_binding_java: -# name: binding_java / ${{ matrix.os }} -# needs: [plan] -# if: fromJson(needs.plan.outputs.plan).components.binding_java -# secrets: inherit -# strategy: -# matrix: -# include: ${{ fromJson(needs.plan.outputs.plan).binding_java }} -# uses: ./.github/workflows/behavior_test_binding_java.yml -# with: -# os: ${{ matrix.os }} -# cases: ${{ toJson(matrix.cases) }} -# -# test_binding_python: -# name: binding_python / ${{ matrix.os }} -# needs: [plan] -# if: fromJson(needs.plan.outputs.plan).components.binding_python -# secrets: inherit -# strategy: -# matrix: -# include: ${{ fromJson(needs.plan.outputs.plan).binding_python }} -# uses: ./.github/workflows/behavior_test_binding_python.yml -# with: -# os: ${{ matrix.os }} -# cases: ${{ toJson(matrix.cases) }} -# -# test_binding_nodejs: -# name: binding_nodejs / ${{ matrix.os }} -# needs: [plan] -# if: fromJson(needs.plan.outputs.plan).components.binding_nodejs -# secrets: inherit -# strategy: -# matrix: -# include: ${{ fromJson(needs.plan.outputs.plan).binding_nodejs }} -# uses: ./.github/workflows/behavior_test_binding_nodejs.yml -# with: -# os: ${{ matrix.os }} -# cases: ${{ toJson(matrix.cases) }} + test_binding_java: + name: binding_java / ${{ matrix.os }} + needs: [plan] + if: fromJson(needs.plan.outputs.plan).components.binding_java + secrets: inherit + strategy: + matrix: + include: ${{ fromJson(needs.plan.outputs.plan).binding_java }} + uses: ./.github/workflows/behavior_test_binding_java.yml + with: + os: ${{ matrix.os }} + cases: ${{ toJson(matrix.cases) }} + + test_binding_python: + name: binding_python / ${{ matrix.os }} + needs: [plan] + if: fromJson(needs.plan.outputs.plan).components.binding_python + secrets: inherit + strategy: + matrix: + include: ${{ fromJson(needs.plan.outputs.plan).binding_python }} + uses: ./.github/workflows/behavior_test_binding_python.yml + with: + os: ${{ matrix.os }} + cases: ${{ toJson(matrix.cases) }} + + test_binding_nodejs: + name: binding_nodejs / ${{ matrix.os }} + needs: [plan] + if: fromJson(needs.plan.outputs.plan).components.binding_nodejs + secrets: inherit + strategy: + matrix: + include: ${{ fromJson(needs.plan.outputs.plan).binding_nodejs }} + uses: ./.github/workflows/behavior_test_binding_nodejs.yml + with: + os: ${{ matrix.os }} + cases: ${{ toJson(matrix.cases) }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70ec135bf848..de199f5d3d3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -202,49 +202,49 @@ jobs: shell: bash run: | FEATURES=( - # services-azblob - # services-azdls - # services-cacache - # services-cos - # services-dashmap - # services-dropbox - # services-etcd + services-azblob + services-azdls + services-cacache + services-cos + services-dashmap + services-dropbox + services-etcd # FIXME this requires a preinstalled fdb library # services-foundationdb - # services-fs - # services-ftp - # services-gcs - # services-gdrive - # services-ghac + services-fs + services-ftp + services-gcs + services-gdrive + services-ghac # FIXME how to support HDFS services in other platforms? # services-hdfs - # services-http - # services-ipfs - # services-ipmfs - # services-memcached - # services-memory - # services-mini-moka - # services-moka - # services-obs - # services-onedrive - # services-oss - # services-persy - # services-postgresql - # services-redb - # services-redis + services-http + services-ipfs + services-ipmfs + services-memcached + services-memory + services-mini-moka + services-moka + services-obs + services-onedrive + services-oss + services-persy + services-postgresql + services-redb + services-redis # TODO: we need to find ways to using pre-install rocksdb library # services-rocksdb - # services-s3 + services-s3 # TODO: sftp is known to not work on windows, waiting for https://github.com/apache/incubator-opendal/issues/2963 # services-sftp - # services-sled + services-sled services-swift - # services-supabase - # services-tikv - # services-vercel-artifacts - # services-wasabi - # services-webdav - # services-webhdfs + services-supabase + services-tikv + services-vercel-artifacts + services-wasabi + services-webdav + services-webhdfs ) cargo build --features "${FEATURES[*]}"