You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/10/18 12:03:08 UTC
[incubator-opendal] 02/02: Migrate redis
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch add-java-test-support
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit dacafce55ab65a1488752aff015aff071593230e
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Wed Oct 18 20:02:56 2023 +0800
Migrate redis
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
.github/scripts/behavior_test/plan.py | 8 ++-
.github/services/redis/redis/action.yml | 40 +++++++++++++
.../services/redis/redis_with_cluster/action.yml | 35 +++++++++++
.github/workflows/service_test_redis.yml | 68 ----------------------
.github/workflows/service_test_s3.yml | 28 ---------
5 files changed, 82 insertions(+), 97 deletions(-)
diff --git a/.github/scripts/behavior_test/plan.py b/.github/scripts/behavior_test/plan.py
index 1f378d352..d24f4b020 100755
--- a/.github/scripts/behavior_test/plan.py
+++ b/.github/scripts/behavior_test/plan.py
@@ -54,7 +54,7 @@ def provided_cases():
cases[:] = [v for v in cases if "secrets" not in v["content"]]
# Remove content from cases.
- return [
+ cases = [
{
"setup": v["setup"],
"service": v["service"],
@@ -63,6 +63,10 @@ def provided_cases():
for v in cases
]
+ # Make sure the order is stable.
+ sorted_cases = sorted(cases, key=lambda x: (x["service"], x["setup"]))
+ return sorted_cases
+
@dataclass
class Hint:
@@ -117,6 +121,8 @@ def calculate_hint(changed_files):
#
# We need this because we have multiple setup for each service and they have already been
# tested by `core` workflow. So we can only test unique setup for each service for bindings.
+#
+# We make sure that we return the first setup for each service in alphabet order.
def unique_cases(cases):
ucases = {}
for case in cases:
diff --git a/.github/services/redis/redis/action.yml b/.github/services/redis/redis/action.yml
new file mode 100644
index 000000000..5fc68b8cb
--- /dev/null
+++ b/.github/services/redis/redis/action.yml
@@ -0,0 +1,40 @@
+# 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: redis
+description: 'Behavior test for redis'
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup Redis with TLS
+ shell: bash
+ working-directory: fixtures/redis
+ run: |
+ # Install the CA in the system
+ sudo cp ssl/ca.crt /usr/local/share/ca-certificates
+ sudo update-ca-certificates
+
+ docker-compose -f docker-compose-redis-tls.yml up -d
+ - name: Setup
+ shell: bash
+ run: |
+ cat << EOF >> $GITHUB_ENV
+ OPENDAL_REDIS_ENDPOINT=rediss://localhost:6379
+ OPENDAL_REDIS_ROOT=/
+ OPENDAL_REDIS_DB=0
+ EOF
diff --git a/.github/services/redis/redis_with_cluster/action.yml b/.github/services/redis/redis_with_cluster/action.yml
new file mode 100644
index 000000000..4caeb85c3
--- /dev/null
+++ b/.github/services/redis/redis_with_cluster/action.yml
@@ -0,0 +1,35 @@
+# 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: redis_with_cluster
+description: 'Behavior test for redis with cluster'
+
+runs:
+ using: "composite"
+ steps:
+ - name: Setup Redis Cluster
+ shell: bash
+ working-directory: fixtures/redis
+ run: docker-compose -f docker-compose-redis-cluster.yml up -d
+ - name: Setup
+ shell: bash
+ run: |
+ cat << EOF >> $GITHUB_ENV
+ OPENDAL_REDIS_CLUSTER_ENDPOINTS=redis://127.0.0.1:6380/,redis://127.0.0.1:6381/,redis://127.0.0.1:6382/,redis://127.0.0.1:6383/,redis://127.0.0.1:6384/,redis://127.0.0.1:6385/
+ OPENDAL_REDIS_ROOT=/test/opendal
+ OPENDAL_REDIS_DB=0
+ EOF
diff --git a/.github/workflows/service_test_redis.yml b/.github/workflows/service_test_redis.yml
index eae70466f..ef8cb682e 100644
--- a/.github/workflows/service_test_redis.yml
+++ b/.github/workflows/service_test_redis.yml
@@ -39,28 +39,6 @@ concurrency:
cancel-in-progress: true
jobs:
- redis:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Setup Redis Server
- shell: bash
- working-directory: fixtures/redis
- run: docker-compose -f docker-compose-redis.yml up -d
- - name: Setup Rust toolchain
- uses: ./.github/actions/setup
- with:
- need-nextest: true
- - name: Test
- shell: bash
- working-directory: core
- run: cargo nextest run behavior --features services-redis
- env:
- OPENDAL_TEST: redis
- OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
- OPENDAL_REDIS_ROOT: /
- OPENDAL_REDIS_DB: 0
-
redis-tls:
runs-on: ubuntu-latest
steps:
@@ -91,29 +69,6 @@ jobs:
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
- redis-cluster:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
- - name: Setup Rust toolchain
- uses: ./.github/actions/setup
- with:
- need-nextest: true
- - name: Setup Redis Cluster
- shell: bash
- working-directory: fixtures/redis
- run: docker-compose -f docker-compose-redis-cluster.yml up -d
- - name: Test
- shell: bash
- working-directory: core
- run: cargo nextest run behavior --features services-redis
- env:
- OPENDAL_TEST: redis
- OPENDAL_REDIS_CLUSTER_ENDPOINTS: redis://127.0.0.1:6380/,redis://127.0.0.1:6381/,redis://127.0.0.1:6382/,redis://127.0.0.1:6383/,redis://127.0.0.1:6384/,redis://127.0.0.1:6385/
- OPENDAL_REDIS_ROOT: /test/opendal
- OPENDAL_REDIS_DB: 0
-
redis-cluster-tls:
runs-on: ubuntu-latest
@@ -193,26 +148,3 @@ jobs:
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
-
- java:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup Rust toolchain
- uses: ./.github/actions/setup
-
- - name: Setup Redis Server
- shell: bash
- working-directory: fixtures/redis
- run: docker-compose -f docker-compose-redis.yml up -d
-
- - name: Test
- shell: bash
- working-directory: bindings/java
- run: ./mvnw test -Dtest="behavior.*Test" -Dcargo-build.features=services-redis
- env:
- OPENDAL_TEST: redis
- OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
- OPENDAL_REDIS_ROOT: /
- OPENDAL_REDIS_DB: 0
diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml
index 27d493bc7..247080584 100644
--- a/.github/workflows/service_test_s3.yml
+++ b/.github/workflows/service_test_s3.yml
@@ -71,34 +71,6 @@ jobs:
OPENDAL_S3_ROLE_ARN: arn:aws:iam::952853449216:role/opendal-testing
OPENDAL_S3_REGION: ap-northeast-1
- java:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Setup MinIO Server
- shell: bash
- working-directory: fixtures/s3
- run: docker-compose -f docker-compose-minio.yml up -d
- - name: Setup test bucket
- env:
- AWS_ACCESS_KEY_ID: "minioadmin"
- AWS_SECRET_ACCESS_KEY: "minioadmin"
- AWS_EC2_METADATA_DISABLED: "true"
- run: aws --endpoint-url http://127.0.0.1:9000/ s3 mb s3://test
- - name: Setup Rust toolchain
- uses: ./.github/actions/setup
- - name: Test
- shell: bash
- working-directory: bindings/java
- run: ./mvnw test -Dtest="behavior.*Test"
- env:
- OPENDAL_TEST: s3
- OPENDAL_S3_BUCKET: test
- OPENDAL_S3_ENDPOINT: "http://127.0.0.1:9000"
- OPENDAL_S3_ACCESS_KEY_ID: minioadmin
- OPENDAL_S3_SECRET_ACCESS_KEY: minioadmin
- OPENDAL_S3_REGION: us-east-1
-
python:
runs-on: ubuntu-latest
steps: