Skip to content

Commit

Permalink
feat(core): add OpenStack Swift e2e test (#3493)
Browse files Browse the repository at this point in the history
* chore: add openstack swift into .env.example

* feat: add openstack swift e2e test

* feat: drop rename as swift doesn't support it

* fix: correct OPENDAL_SWIFT_ROOT value

* chore: use another way to export env variables

* tmp: add debug log

* chore: modify timout and retries values

* fix: adding tr -d '\n' to fix weird bug

* chore: add trim_end to token as triage weird bug

* chore: don't use token from GITHUB_ENV

* feat: export env variable at once

* chore: use different format to export env variable

* chore: use echo -e to enable backslash escapes.

* chore: use cat EOF to set token

* chore: workaround by pre-apply token and trim end

* chore: triage by merge two steps together

* chore: prune and separate steps

* chore: reset comment out for debug purpose
  • Loading branch information
morristai authored Nov 7, 2023
1 parent 2ef5465 commit 6909f3a
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,9 @@ OPENDAL_AZFILE_ROOT=/tmp/opendal/
OPENDAL_AZFILE_ACCOUNT_NAME=<account_name>
OPENDAL_AZFILE_ACCOUNT_KEY=<account_key>
OPENDAL_AZFILE_SHARE_NAME=<shared_name>
# openstack swift
OPENDAL_SWIFT_ENDPOINT=<endpoint>
OPENDAL_SWIFT_ACCOUNT=<account>
OPENDAL_SWIFT_CONTAINER=<container>
OPENDAL_SWIFT_ROOT=/path/to/dir
OPENDAL_SWIFT_TOKEN=<token>
45 changes: 45 additions & 0 deletions .github/services/swift/swift/action.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions bindings/java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ services-all = [
"services-sqlite",
"services-azfile",
"services-libsql",
"services-swift",
]

# Default services provided by opendal.
Expand Down Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions bindings/nodejs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ services-all = [
"services-rocksdb",
"services-sled",
"services-supabase",
"services-swift",
"services-tikv",
"services-vercel-artifacts",
"services-wasabi",
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ services-all = [
"services-rocksdb",
"services-sled",
"services-supabase",
"services-swift",
"services-tikv",
"services-vercel-artifacts",
"services-wasabi",
Expand Down Expand Up @@ -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"]
Expand Down
1 change: 0 additions & 1 deletion core/src/services/swift/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ impl Accessor for SwiftBackend {
write: true,
create_dir: true,
delete: true,
rename: true,

list: true,
list_with_delimiter_slash: true,
Expand Down
29 changes: 29 additions & 0 deletions fixtures/swift/docker-compose-swift.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6909f3a

Please sign in to comment.