Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add OpenStack Swift e2e test #3493

Merged
merged 19 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}')
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"
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved

- 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
76 changes: 38 additions & 38 deletions .github/workflows/behavior_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) }}
69 changes: 35 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,48 +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-supabase
services-tikv
services-vercel-artifacts
services-wasabi
services-webdav
services-webhdfs
# services-sled
services-swift
# services-supabase
# services-tikv
# services-vercel-artifacts
# services-wasabi
# services-webdav
# services-webhdfs
)
cargo build --features "${FEATURES[*]}"

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
1 change: 1 addition & 0 deletions core/src/services/swift/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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
Loading