From 251e7f3b844d7c917c7ed30b53fe3a517d87a5f6 Mon Sep 17 00:00:00 2001 From: G-XD Date: Fri, 13 Oct 2023 15:32:29 +0800 Subject: [PATCH 1/2] test(binding/java): grouping tests with tag --- .github/workflows/service_test_redis.yml | 2 +- .github/workflows/service_test_s3.yml | 2 +- bindings/java/README.md | 12 ++++++++++++ .../opendal/test/behavior/ServiceBehaviorTests.java | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/service_test_redis.yml b/.github/workflows/service_test_redis.yml index 0d06763d1133..1e1feb3a9508 100644 --- a/.github/workflows/service_test_redis.yml +++ b/.github/workflows/service_test_redis.yml @@ -210,7 +210,7 @@ jobs: - name: Test shell: bash working-directory: bindings/java - run: ./mvnw test -Dtest=org.apache.opendal.test.behavior.RedisTest -Dcargo-build.features=services-redis + run: ./mvnw test -Dgroups="services-redis" -Dcargo-build.features=services-redis env: OPENDAL_REDIS_TEST: on OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379 diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml index 95f703ab7095..fbc66b061c78 100644 --- a/.github/workflows/service_test_s3.yml +++ b/.github/workflows/service_test_s3.yml @@ -241,7 +241,7 @@ jobs: - name: Test shell: bash working-directory: bindings/java - run: ./mvnw test -Dtest=org.apache.opendal.test.behavior.S3Test + run: ./mvnw test -Dgroups="services-s3" env: OPENDAL_S3_TEST: on OPENDAL_S3_BUCKET: test diff --git a/bindings/java/README.md b/bindings/java/README.md index 48caad9dc899..7fc58e9d8b70 100644 --- a/bindings/java/README.md +++ b/bindings/java/README.md @@ -126,8 +126,20 @@ You can run service tests of enabled with the following command: ./mvnw test -Dtest=org.apache.opendal.behavior.FsTest # replace with the certain service tests ``` +Or: + +```shell +./mvnw test -Dgroups="services-fs" # replace with the certain service tests +``` + Remember to enable the necessary features via `-Dcargo-build.features=services-xxx` when running specific service test: ```shell ./mvnw test -Dtest=org.apache.opendal.behavior.RedisTest -Dcargo-build.features=services-redis ``` + +Or: + +```shell +./mvnw test -Dgroups="services-redis" -Dcargo-build.features=services-redis +``` diff --git a/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java b/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java index da47fdfea572..9af2c300ff76 100644 --- a/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java +++ b/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java @@ -23,8 +23,10 @@ import java.util.Map; import lombok.extern.slf4j.Slf4j; import org.assertj.core.util.Files; +import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.condition.EnabledIf; +@Tag("services-memory") @Slf4j class MemoryTest extends AbstractBehaviorTest { public MemoryTest() { @@ -43,6 +45,7 @@ private static Map defaultSchemeConfig() { } } +@Tag("services-fs") @Slf4j class FsTest extends AbstractBehaviorTest { public FsTest() { @@ -64,6 +67,7 @@ private static Map schemeConfig() { } } +@Tag("services-redis") @EnabledIf("enabled") class RedisTest extends AbstractBehaviorTest { public RedisTest() { @@ -75,6 +79,7 @@ private static boolean enabled() { } } +@Tag("services-s3") @EnabledIf("enabled") class S3Test extends AbstractBehaviorTest { public S3Test() { From e6b45af84ae823a6663ab11a1dde280419962289 Mon Sep 17 00:00:00 2001 From: G-XD Date: Fri, 13 Oct 2023 15:53:23 +0800 Subject: [PATCH 2/2] test(binding/java): rename test tag --- .github/workflows/service_test_redis.yml | 2 +- .github/workflows/service_test_s3.yml | 2 +- bindings/java/README.md | 4 ++-- .../opendal/test/behavior/ServiceBehaviorTests.java | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/service_test_redis.yml b/.github/workflows/service_test_redis.yml index 1e1feb3a9508..70daf3cbbfa5 100644 --- a/.github/workflows/service_test_redis.yml +++ b/.github/workflows/service_test_redis.yml @@ -210,7 +210,7 @@ jobs: - name: Test shell: bash working-directory: bindings/java - run: ./mvnw test -Dgroups="services-redis" -Dcargo-build.features=services-redis + run: ./mvnw test -Dgroups="services_redis" -Dcargo-build.features=services-redis env: OPENDAL_REDIS_TEST: on OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379 diff --git a/.github/workflows/service_test_s3.yml b/.github/workflows/service_test_s3.yml index fbc66b061c78..423efab0a2b5 100644 --- a/.github/workflows/service_test_s3.yml +++ b/.github/workflows/service_test_s3.yml @@ -241,7 +241,7 @@ jobs: - name: Test shell: bash working-directory: bindings/java - run: ./mvnw test -Dgroups="services-s3" + run: ./mvnw test -Dgroups="services_s3" env: OPENDAL_S3_TEST: on OPENDAL_S3_BUCKET: test diff --git a/bindings/java/README.md b/bindings/java/README.md index 7fc58e9d8b70..5a7596e0345d 100644 --- a/bindings/java/README.md +++ b/bindings/java/README.md @@ -129,7 +129,7 @@ You can run service tests of enabled with the following command: Or: ```shell -./mvnw test -Dgroups="services-fs" # replace with the certain service tests +./mvnw test -Dgroups="services_fs" # replace with the certain service tests ``` Remember to enable the necessary features via `-Dcargo-build.features=services-xxx` when running specific service test: @@ -141,5 +141,5 @@ Remember to enable the necessary features via `-Dcargo-build.features=services-x Or: ```shell -./mvnw test -Dgroups="services-redis" -Dcargo-build.features=services-redis +./mvnw test -Dgroups="services_redis" -Dcargo-build.features=services-redis ``` diff --git a/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java b/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java index 9af2c300ff76..c8154419a32f 100644 --- a/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java +++ b/bindings/java/src/test/java/org/apache/opendal/test/behavior/ServiceBehaviorTests.java @@ -26,7 +26,7 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.condition.EnabledIf; -@Tag("services-memory") +@Tag("services_memory") @Slf4j class MemoryTest extends AbstractBehaviorTest { public MemoryTest() { @@ -45,7 +45,7 @@ private static Map defaultSchemeConfig() { } } -@Tag("services-fs") +@Tag("services_fs") @Slf4j class FsTest extends AbstractBehaviorTest { public FsTest() { @@ -67,7 +67,7 @@ private static Map schemeConfig() { } } -@Tag("services-redis") +@Tag("services_redis") @EnabledIf("enabled") class RedisTest extends AbstractBehaviorTest { public RedisTest() { @@ -79,7 +79,7 @@ private static boolean enabled() { } } -@Tag("services-s3") +@Tag("services_s3") @EnabledIf("enabled") class S3Test extends AbstractBehaviorTest { public S3Test() {