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

test(binding/java): add behavior test framework #3129

Merged
merged 26 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
43cbec8
test(binding/java): add behavior test
G-XD Sep 18, 2023
c51bbab
test(binding/java): override append test for s3
G-XD Sep 18, 2023
a878d0d
ci(services/redis): add behavior test for binding java
G-XD Sep 18, 2023
e72e742
ci(services/s3): add behavior test for binding java
G-XD Sep 18, 2023
2a165e4
test(binding/java): del redis test
G-XD Sep 18, 2023
396c019
test(binding/java): add behavior test for memory & fs
G-XD Sep 18, 2023
418d5e6
style(binding/java): fix code style
G-XD Sep 18, 2023
d5d8dd8
test(binding/java): del cucumber test
G-XD Sep 18, 2023
60e2b4d
test(binding/java): refactor append test
G-XD Sep 18, 2023
bd95181
test(binding/java): refactor blocking test
G-XD Sep 19, 2023
f14775a
test(binding/java): skip tests if the env is not set
G-XD Sep 19, 2023
9afb744
ci(services/redis): setup redis server
G-XD Sep 19, 2023
8e621a6
chore(binding/java): reuse the .env.example
G-XD Sep 19, 2023
708d325
feat(binding/java): support info ops
G-XD Sep 21, 2023
5b022c0
test(binding/java): add operator info test
G-XD Sep 21, 2023
1fe237c
test(binding/java): refactor behavior test
G-XD Sep 21, 2023
c7d354f
Merge branch 'main' into behavior_test_java
G-XD Sep 21, 2023
accfdc8
test(binding/java): fix code style
G-XD Sep 21, 2023
30d4df8
test(binding/java): reuse the .env file
G-XD Sep 21, 2023
cefcc73
ci(binding/java): fix test command
G-XD Sep 21, 2023
55a495a
Merge branch 'main' into behavior_test_java
G-XD Sep 21, 2023
5d9bfd9
test(binding/java): init all services test that OPENDAL_<SERVICE>_ON …
G-XD Sep 21, 2023
f3019b9
ci(binding/java): del test
G-XD Sep 21, 2023
f6d8395
test(binding/java): skip test when no services turn on
G-XD Sep 21, 2023
658a675
doc(binding/java): update doc
G-XD Sep 21, 2023
aee4b5c
test(binding/java): del schema enum
G-XD Sep 22, 2023
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
4 changes: 0 additions & 4 deletions .github/workflows/bindings_java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,4 @@ jobs:
# https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-to-test-my-maven-build-reproducibility
shell: bash
run: |
if [[ "${{ runner.os }}" != Linux ]]; then
export NO_DOCKER=true
fi
./mvnw clean install -DskipTests -Dcargo-build.features=services-redis
./mvnw verify artifact:compare -Dcargo-build.features=services-redis
tisonkun marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions .github/workflows/service_test_redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,26 @@ jobs:
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0

binding_java_redis:
Xuanwo marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- 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=org.apache.opendal.OperatorTest -Dcargo-build.features=services-redis
env:
OPENDAL_REDIS_TEST: on
OPENDAL_REDIS_ENDPOINT: tcp://127.0.0.1:6379
OPENDAL_REDIS_ROOT: /
OPENDAL_REDIS_DB: 0
21 changes: 21 additions & 0 deletions .github/workflows/service_test_s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,24 @@ jobs:
# This is the R2's limitation
# Refer to https://opendal.apache.org/docs/services/s3#compatible-services for more information
OPENDAL_S3_ENABLE_EXACT_BUF_WRITE: true

binding_java_s3:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Rust toolchain
uses: ./.github/actions/setup

- name: Test
shell: bash
working-directory: bindings/java
run: ./mvnw test -Dtest=org.apache.opendal.OperatorTest
env:
OPENDAL_S3_TEST: ${{ secrets.OPENDAL_S3_TEST }}
OPENDAL_S3_ROOT: ${{ secrets.OPENDAL_S3_ROOT }}
OPENDAL_S3_BUCKET: ${{ secrets.OPENDAL_S3_BUCKET }}
OPENDAL_S3_ENDPOINT: ${{ secrets.OPENDAL_S3_ENDPOINT }}
OPENDAL_S3_ACCESS_KEY_ID: ${{ secrets.OPENDAL_S3_ACCESS_KEY_ID }}
OPENDAL_S3_SECRET_ACCESS_KEY: ${{ secrets.OPENDAL_S3_SECRET_ACCESS_KEY }}
OPENDAL_S3_REGION: ap-northeast-1
36 changes: 33 additions & 3 deletions bindings/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,42 @@ You can use Maven to build both Rust dynamic lib and JAR files with one command

## Run tests

Currently, all tests are written in Java. It contains the Cucumber feature tests and other unit tests.
Currently, all tests are written in Java.

You can run tests with the following command:
You can run the base tests with the following command:

```shell
./mvnw clean verify -Dcargo-build.features=services-redis
./mvnw clean verify
```

## Run Service Tests

Please copy `{project.rootdir}/.env.example` to `{project.rootdir}/.env` and change the values on need.

Take `fs` for example, we need to enable bench on `fs` on `/tmp`.

```dotenv
OPENDAL_FS_TEST=false
OPENDAL_FS_ROOT=/path/to/dir
```

into

```dotenv
OPENDAL_FS_TEST=on
OPENDAL_FS_ROOT=/opendal
```

You can run service tests of enabled with the following command:

```shell
./mvnw test -Dtest=org.apache.opendal.OperatorTest
```

You can run the unbound service with the following command:

```shell
./mvnw test -Dtest=org.apache.opendal.OperatorTest -Dcargo-build.features=services-redis
```

> **Note:**
Expand Down
111 changes: 111 additions & 0 deletions bindings/java/src/main/java/org/apache/opendal/enums/Schema.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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.
*/

package org.apache.opendal.enums;

public enum Schema {
G-XD marked this conversation as resolved.
Show resolved Hide resolved
Atomicserver("atomicserver"),

Azblob("azblob"),

Azdls("azdls"),

Cacache("cacache"),

Cos("cos"),

Dashmap("dashmap"),

Etcd("etcd"),

Foundationdb("foundationdb"),

Fs("fs"),

Ftp("ftp"),

Gcs("gcs"),

Ghac("ghac"),

Hdfs("hdfs"),

Http("http"),

Ipfs("ipfs"),

Ipmfs("ipmfs"),

Memcached("memcached"),

Memory("memory"),

MiniMoka("minimoka"),

Moka("moka"),

Obs("obs"),

Onedrive("onedrive"),

Gdrive("gdrive"),

Dropbox("dropbox"),

Oss("oss"),

Persy("persy"),

Redis("redis"),

Postgresql("postgresql"),

Rocksdb("rocksdb"),

S3("s3"),

Sftp("sftp"),

Sled("sled"),

Supabase("supabase"),

VercelArtifacts("vercel-artifacts"),

Wasabi("wasabi"),

Webdav("webdav"),

Webhdfs("webhdfs"),

Redb("redb"),

Tikv("tikv"),
;

private final String servicesName;

private Schema(String name) {
this.servicesName = name;
}

public String getServicesName() {
return servicesName;
}
}

This file was deleted.

This file was deleted.

Loading