Skip to content

Commit

Permalink
refactor(tests): Apply OPENDAL_TEST for behavior test (#3322)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xuanwo authored Oct 17, 2023
1 parent 3b63006 commit 5d2cb57
Show file tree
Hide file tree
Showing 49 changed files with 251 additions and 345 deletions.
38 changes: 0 additions & 38 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,155 +1,122 @@
# memory
OPENDAL_MEMORY_TEST=on
# fs
OPENDAL_FS_TEST=false
OPENDAL_FS_ROOT=/path/to/dir
OPENDAL_FS_ATOMIC_WRITE_DIR=/path/to/tempdir
# cos
OPENDAL_COS_TEST=false
OPENDAL_COS_BUCKET=opendal-testing-1318209832
OPENDAL_COS_ENDPOINT=https://cos.ap-singapore.myqcloud.com
OPENDAL_COS_SECRET_ID=<secret_id>
OPENDAL_COS_SECRET_KEY=<secret_key>
# s3
OPENDAL_S3_TEST=false
OPENDAL_S3_BUCKET=<bucket>
OPENDAL_S3_ENDPOINT=<endpoint>
OPENDAL_S3_REGION=<region>
OPENDAL_S3_ACCESS_KEY_ID=<access_key_id>
OPENDAL_S3_SECRET_ACCESS_KEY=<secret_access_key>
# azblob
OPENDAL_AZBLOB_TEST=false
OPENDAL_AZBLOB_ROOT=/path/to/dir
OPENDAL_AZBLOB_CONTAINER=<container>
OPENDAL_AZBLOB_ENDPOINT=<endpoint>
OPENDAL_AZBLOB_ACCOUNT_NAME=<account_name>
OPENDAL_AZBLOB_ACCOUNT_KEY=<account_key>
# hdfs
OPENDAL_HDFS_TEST=false
OPENDAL_HDFS_ROOT=/path/to/dir
OPENDAL_HDFS_NAME_NODE=<name_node>
# gcs
OPENDAL_GCS_TEST=false
OPENDAL_GCS_ROOT=/path/to/dir
OPENDAL_GCS_BUCKET=<bucket>
OPENDAL_GCS_CREDENTIAL=<base64_content>
# obs
OPENDAL_OBS_TEST=false
OPENDAL_OBS_BUCKET=<bucket>
OPENDAL_OBS_ENDPOINT=<endpoint>
OPENDAL_OBS_ACCESS_KEY_ID=<access_key_id>
OPENDAL_OBS_SECRET_ACCESS_KEY=<secret_access_key>
# oss
OPENDAL_OSS_TEST=false
OPENDAL_OSS_BUCKET=<bucket>
OPENDAL_OSS_ENDPOINT=<endpoint>
OPENDAL_OSS_ACCESS_KEY_ID=<access_key_id>
OPENDAL_OSS_ACCESS_KEY_SECRET=<access_key_secret>
# ipmfs
OPENDAL_IPMFS_TEST=false
OPENDAL_IPMFS_ROOT=/path/to/dir
OPENDAL_IPMFS_ENDPOINT=http://localhost:5001
# ftp
OPENDAL_FTP_TEST=false
OPENDAL_FTP_ENDPOINT=ftp://<endpoint>
OPENDAL_FTP_ROOT=/path/to/dir
OPENDAL_FTP_USER=<user>
OPENDAL_FTP_PASSWORD=<password>
# ipfs
OPENDAL_IPFS_TEST=false
OPENDAL_IPFS_ROOT=/ipfs/Qmxxxxxxxx
OPENDAL_IPFS_ENDPOINT=http://localhost:8080
# redis
OPENDAL_REDIS_TEST=false
OPENDAL_REDIS_ENDPOINT=tcp://127.0.0.1:6379
# OPENDAL_REDIS_CLUSTER_ENDPOINTS=rediss://127.0.0.1:6380,rediss://127.0.0.1:6381,rediss://127.0.0.1:6382,rediss://127.0.0.1:6383,rediss://127.0.0.1:6384,rediss://127.0.0.1:6385
OPENDAL_REDIS_ROOT=/
OPENDAL_REDIS_DB=0
# rocksdb
OPENDAL_ROCKSDB_TEST=false
OPENDAL_ROCKSDB_DATADIR=/path/to/database
OPENDAL_ROCKSDB_ROOT=/path/to/root
# sftp
OPENDAL_SFTP_TEST=false
OPENDAL_SFTP_ENDPOINT=ssh://<endpoint>
OPENDAL_SFTP_ROOT=/path/to/dir
OPENDAL_SFTP_USER=<user>
OPENDAL_SFTP_KEY=<key_path>
OPENDAL_SFTP_KNOWN_HOSTS_STRATEGY=<accept|add|strict>
# sled
OPENDAL_SLED_TEST=false
OPENDAL_SLED_DATADIR=/path/to/database
OPENDAL_SLED_TREE=sled-tree
# mini-moka
OPENDAL_MINI_MOKA_TEST=false
# moka
OPENDAL_MOKA_TEST=false
# ghac
OPENDAL_GHAC_TEST=false
# memcached
OPENDAL_MEMCACHED_TEST=false
OPENDAL_MEMCACHED_ENDPOINT=tcp://127.0.0.1:11211
OPENDAL_MEMCACHED_ROOT=/
# webdav
OPENDAL_WEBDAV_TEST=false
OPENDAL_WEBDAV_ROOT=/tmp/opendal/
OPENDAL_WEBDAV_ENDPOINT=http://127.0.0.1:8080
# webhfds
OPENDAL_WEBHDFS_TEST=false
OPENDAL_WEBHDFS_ROOT=/tmp/opendal/
OPENDAL_WEBHDFS_ENDPOINT=http://127.0.0.1:9870
OPENDAL_WEBHDFS_DELEGATION=<delegation>
OPENDAL_WEBHDFS_DISABLE_LIST_BATCH=false
# supbase
OPENDAL_SUPABASE_TEST=false
OPENDAL_SUPABASE_BUCKET=<bucket>
OPENDAL_SUPABASE_ENDPOINT=<endpoint>
OPENDAL_SUPABASE_KEY=<service_key>
# vercel artifacts
OPENDAL_VERCEL_ARTIFACTS_TEST=false
OPENDAL_VERCEL_ARTIFACTS_ACCESS_TOKEN=<token>
# onedrive
OPENDAL_ONEDRIVE_TEST=false
OPENDAL_ONEDRIVE_ACCESS_TOKEN=<access_token>
# wasabi
OPENDAL_WASABI_TEST=false
OPENDAL_WASABI_REGION=<region>
OPENDAL_WASABI_BUCKET=<bucket>
OPENDAL_WASABI_ENDPOINT=<endpoint>
OPENDAL_WASABI_ACCESS_KEY_ID=<ak>
OPENDAL_WASABI_SECRET_ACCESS_KEY=<sk>
# atomicserver
OPENDAL_ATOMICSERVER_TEST=false
OPENDAL_ATOMICSERVER_ROOT=/path/to/dir
OPENDAL_ATOMICSERVER_ENDPOINT=http://localhost:9883
OPENDAL_ATOMICSERVER_PRIVATE_KEY=<private_key>
OPENDAL_ATOMICSERVER_PUBLIC_KEY=<public_key>
OPENDAL_ATOMICSERVER_PARENT_RESOURCE_ID=http://localhost:9883
# foundationdb
OPENDAL_FOUNDATIONDB_TEST=false
OPENDAL_FOUNDATIONDB_ROOT=/path/to/dir
OPENDAL_FOUNDATIONDB_CONFIG_PATH=/tmp/opendal/foundationdb.conf
# redb
OPENDAL_REDB_TEST=false
OPENDAL_REDB_DATADIR=/tmp/redb
OPENDAL_REDB_TABLE=redb-table
# cacache
OPENDAL_CACACHE_TEST=false
OPENDAL_CACACHE_DATADIR=/tmp/opendal/cacache/
# persy
OPENDAL_PERSY_TEST=false
OPENDAL_PERSY_DATAFILE=/tmp/opendal/test.persy
OPENDAL_PERSY_SEGMENT=data
OPENDAL_PERSY_INDEX=index
#dropbox
OPENDAL_DROPBOX_TEST=false
OPENDAL_DROPBOX_ROOT=/tmp/opendal/
OPENDAL_DROPBOX_ACCESS_TOKEN=<access_token>
OPENDAL_DROPBOX_REFRESH_TOKEN=<refresh_token>
OPENDAL_DROPBOX_CLIENT_ID=<client_id>
OPENDAL_DROPBOX_CLIENT_SECRET=<client_secret>
# etcd
OPENDAL_ETCD_TEST=false
OPENDAL_ETCD_ENDPOINTS=127.0.0.1:2379
OPENDAL_ETCD_ROOT=/tmp/opendal/
OPENDAL_ETCD_USERNAME=<username>
Expand All @@ -158,36 +125,31 @@ OPENDAL_ETCD_CA_PATH=<ca_path>
OPENDAL_ETCD_CERT_PATH=<cert_path>
OPENDAL_ETCD_KEY_PATH=<key_path>
# google drive
OPENDAL_GDRIVE_TEST=false
OPENDAL_GDRIVE_ROOT=/tmp/opendal/
OPENDAL_GDRIVE_ACCESS_TOKEN=<access_token>
OPENDAL_GDRIVE_REFRESH_TOKEN=<refresh_token>
OPENDAL_GDRIVE_CLIENT_ID=<client_id>
OPENDAL_GDRIVE_CLIENT_SECRET=<client_secret>
# libsql
OPENDAL_LIBSQL_TEST=false
OPENDAL_LIBSQL_ROOT=/tmp/opendal/
OPENDAL_LIBSQL_CONNECTION_STRING=https://example.com/db
OPENDAL_LIBSQL_AUTH_TOKEN=<secret>
OPENDAL_LIBSQL_TABLE=t_opendal
OPENDAL_LIBSQL_KEY_FIELD=key
OPENDAL_LIBSQL_VALUE_FIELD=val
# sqlite
OPENDAL_SQLITE_TEST=on
OPENDAL_SQLITE_CONNECTION_STRING=file:///tmp/opendal/test.db
OPENDAL_SQLITE_TABLE=data
OPENDAL_SQLITE_KEY_FIELD=key
OPENDAL_SQLITE_VALUE_FIELD=data
# d1
OPENDAL_D1_TEST=false
OPENDAL_D1_TOKEN=<token>
OPENDAL_D1_ACCOUNT_ID=<account_id>
OPENDAL_D1_DATABASE_ID=<database_id>
OPENDAL_D1_TABLE=<table>
OPENDAL_D1_KEY_FIELD=<key_field>
OPENDAL_D1_VALUE_FIELD=<value_field>
# azfile
OPENDAL_AZFILE_TEST=false
OPENDAL_AZFILE_ENDPOINT=<endpoint>
OPENDAL_AZFILE_ROOT=/tmp/opendal/
OPENDAL_AZFILE_ACCOUNT_NAME=<account_name>
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/test-core/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ runs:
- name: Run Test Core
shell: bash
working-directory: core
run: cargo nextest run services_${{ inputs.service }} --archive-file=./core-test.tar.zst
run: cargo nextest run behavior --archive-file=./core-test.tar.zst
env:
OPENDAL_TEST: ${{ inputs.service }}
EOF
- name: Run
id: run
Expand Down
1 change: 0 additions & 1 deletion .github/services/fs/local-fs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ runs:
- name: Setup
shell: bash
run: |
echo "OPENDAL_FS_TEST=on" >> $GITHUB_ENV
echo "OPENDAL_FS_ROOT=${{ runner.temp }}/" >> $GITHUB_ENV
1 change: 0 additions & 1 deletion .github/services/s3/aws-s3/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ runs:
- name: Setup
shell: bash
run: |
echo "OPENDAL_S3_TEST=${{ fromJson(inputs.secrets).OPENDAL_S3_TEST }}" >> $GITHUB_ENV
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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/service_test_atomicserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
shell: bash
working-directory: core
run: |
cargo test atomicserver --features services-atomicserver -j=1
cargo test behavior --features services-atomicserver -j=1
env:
RUST_BACKTRACE: full
OPENDAL_ATOMICSERVER_TEST: off
# TODO: enable test when we are ready.
# OPENDAL_TEST: atomicserver
OPENDAL_ATOMICSERVER_ROOT: TODO - ${{ secrets.OPENDAL_ATOMICSERVER_ROOT }}
OPENDAL_ATOMICSERVER_ENDPOINT: TODO - ${{ secrets.OPENDAL_ATOMICSERVER_ENDPOINT }}
OPENDAL_ATOMICSERVER_PRIVATE_KEY: TODO - ${{ secrets.OPENDAL_ATOMICSERVER_PRIVATE_KEY }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/service_test_azblob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ jobs:
- name: Test
shell: bash
working-directory: core
run: cargo nextest run azblob
run: cargo nextest run behavior
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_AZBLOB_TEST: on
OPENDAL_TEST: azblob
OPENDAL_AZBLOB_CONTAINER: test
OPENDAL_AZBLOB_ENDPOINT: "http://127.0.0.1:10000/devstoreaccount1"
OPENDAL_AZBLOB_ACCOUNT_NAME: devstoreaccount1
Expand All @@ -90,7 +90,6 @@ jobs:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OPENDAL_AZBLOB_TEST: op://services/azblob/test
OPENDAL_AZBLOB_CONTAINER: op://services/azblob/container
OPENDAL_AZBLOB_ENDPOINT: op://services/azblob/endpoint
OPENDAL_AZBLOB_ACCOUNT_NAME: op://services/azblob/account_name
Expand All @@ -99,4 +98,6 @@ jobs:
- name: Test
shell: bash
working-directory: core
run: cargo nextest run azblob
run: cargo nextest run behavior
env:
OPENDAL_TEST: azblob
22 changes: 16 additions & 6 deletions .github/workflows/service_test_azdls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ jobs:
uses: ./.github/actions/setup
with:
need-nextest: true

- name: Load secret
id: op-load-secret
uses: 1password/load-secrets-action@v1
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OPENDAL_AZDLS_FILESYSTEM: op://services/azdls/filesystem
OPENDAL_AZDLS_ENDPOINT: op://services/azdls/endpoint
OPENDAL_AZDLS_ACCOUNT_NAME: op://services/azdls/account_name
OPENDAL_AZDLS_ACCOUNT_KEY: op://services/azdls/account_key

- name: Test
shell: bash
working-directory: core
run: cargo nextest run azdls
run: cargo nextest run behavior
env:
OPENDAL_AZDLS_TEST: ${{ secrets.OPENDAL_AZDLS_TEST }}
OPENDAL_AZDLS_FILESYSTEM: ${{ secrets.OPENDAL_AZDLS_FILESYSTEM }}
OPENDAL_AZDLS_ENDPOINT: ${{ secrets.OPENDAL_AZDLS_ENDPOINT }}
OPENDAL_AZDLS_ACCOUNT_NAME: ${{ secrets.OPENDAL_AZDLS_ACCOUNT_NAME }}
OPENDAL_AZDLS_ACCOUNT_KEY: ${{ secrets.OPENDAL_AZDLS_ACCOUNT_KEY }}
OPENDAL_TEST: azdls
OPENDAL_AZDLS_ROOT: test/
4 changes: 2 additions & 2 deletions .github/workflows/service_test_cacache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- name: Test cacache
shell: bash
working-directory: core
run: cargo test cacache --features services-cacache -j=1
run: cargo test behavior --features services-cacache -j=1
env:
RUST_BACKTRACE: full
RUST_LOG: debug
OPENDAL_CACACHE_TEST: on
OPENDAL_TEST: cacache
OPENDAL_CACACHE_DATADIR: /tmp/opendal/cacache/
5 changes: 3 additions & 2 deletions .github/workflows/service_test_cos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OPENDAL_COS_TEST: op://services/cos/test
OPENDAL_COS_BUCKET: op://services/cos/bucket
OPENDAL_COS_ENDPOINT: op://services/cos/endpoint
OPENDAL_COS_SECRET_ID: op://services/cos/secret_id
Expand All @@ -63,4 +62,6 @@ jobs:
- name: Test
shell: bash
working-directory: core
run: cargo nextest run cos
run: cargo nextest run behavior
env:
OPENDAL_TEST: cos
4 changes: 2 additions & 2 deletions .github/workflows/service_test_dashmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ jobs:
- name: Test
shell: bash
working-directory: core
run: cargo nextest run dashmap --features services-dashmap
run: cargo nextest run behavior --features services-dashmap
env:
OPENDAL_DASHMAP_TEST: on
OPENDAL_TEST: dashmap
5 changes: 3 additions & 2 deletions .github/workflows/service_test_dropbox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OPENDAL_DROPBOX_TEST: op://services/dropbox/test
OPENDAL_DROPBOX_ROOT: op://services/dropbox/root
OPENDAL_DROPBOX_REFRESH_TOKEN: op://services/dropbox/refresh_token
OPENDAL_DROPBOX_CLIENT_ID: op://services/dropbox/client_id
Expand All @@ -63,4 +62,6 @@ jobs:
working-directory: core
# It's easily for dropbox to trigger too_many_write_operations error.
# So we run tests one by one.
run: cargo test dropbox --features=services-dropbox -- --test-threads=1
run: cargo test behavior --features=services-dropbox -- --test-threads=1
env:
OPENDAL_TEST: dropbox
Loading

0 comments on commit 5d2cb57

Please sign in to comment.