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= diff --git a/.github/services/swift/swift/action.yml b/.github/services/swift/swift/action.yml new file mode 100644 index 000000000000..397eba16addf --- /dev/null +++ b/.github/services/swift/swift/action.yml @@ -0,0 +1,45 @@ +# 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 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}') + 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=/ + 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/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, diff --git a/fixtures/swift/docker-compose-swift.yml b/fixtures/swift/docker-compose-swift.yml new file mode 100644 index 000000000000..02b83572b852 --- /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: 3s + timeout: 20s + retries: 10 \ No newline at end of file