diff --git a/.github/workflows/service_test_redis.yml b/.github/workflows/service_test_redis.yml index 0d06763d1133..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 -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..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 -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..5a7596e0345d 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..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 @@ -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() {