Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
Signed-off-by: Manjusaka <[email protected]>
  • Loading branch information
Zheaoli committed Oct 26, 2023
1 parent cfc8125 commit 2209682
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/actions/behavior_test_binding_java/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ runs:
- name: Run Test Binding Java
shell: bash
working-directory: bindings/java
run: ./mvnw test -Dtest="behavior.*Test" -Dcargo-build.features=${{ inputs.feature }}
run: ./mvnw test -Dtest="behavior.*Test" -Dcargo-build.features=${{ inputs.feature }},test-retry
env:
OPENDAL_TEST: ${{ inputs.service }}
EOF
Expand Down
3 changes: 2 additions & 1 deletion bindings/java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ services-vercel-artifacts = ["opendal/services-vercel-artifacts"]
services-wasabi = ["opendal/services-wasabi"]
services-mysql = ["opendal/services-mysql"]
services-mongodb = ["opendal/services-mongodb"]
"services-libsql" = ["opendal/services-libsql"]
services-libsql = ["opendal/services-libsql"]
test-retry = []

[dependencies]
anyhow = "1.0.71"
Expand Down
7 changes: 7 additions & 0 deletions bindings/java/src/operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,18 @@ pub extern "system" fn Java_org_apache_opendal_Operator_constructor(
fn intern_constructor(env: &mut JNIEnv, scheme: JString, map: JObject) -> Result<jlong> {
let scheme = Scheme::from_str(jstring_to_string(env, &scheme)?.as_str())?;
let map = jmap_to_hashmap(env, &map)?;

let mut op = Operator::via_map(scheme, map)?;
if !op.info().full_capability().blocking {
let _guard = unsafe { get_global_runtime() }.enter();
op = op.layer(BlockingLayer::create()?);
}
#[cfg(feature = "test-retry")]
let op = {
use opendal::layers::RetryLayer;
op.layer(RetryLayer::new().with_max_times(4))
};

Ok(Box::into_raw(Box::new(op)) as jlong)
}

Expand Down

0 comments on commit 2209682

Please sign in to comment.