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 06233b6 commit 3694368
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/actions/behavior_test_binding_java/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ inputs:
runs:
using: "composite"
steps:
<<<<<<< HEAD
- name: Setup
shell: bash
run: |
Expand All @@ -47,3 +48,24 @@ runs:
EOF
- name: Run
uses: ./dynamic_test_binding_java
=======
- name: Setup
shell: bash
run: |
mkdir -p ./dynamic_test_binding_java &&
cat <<EOF >./dynamic_test_binding_java/action.yml
runs:
using: composite
steps:
- name: Setup Test
uses: ./.github/services/${{ inputs.service }}/${{ inputs.setup }}
- name: Run Test Binding Java
shell: bash
working-directory: bindings/java
run: ./mvnw test -Dtest="behavior.*Test" -Dcargo-build.features=${{ inputs.feature }},test-retry
env:
OPENDAL_TEST: ${{ inputs.service }}
EOF
- name: Run
uses: ./dynamic_test_binding_java
>>>>>>> 22096828e (fix test error)
1 change: 1 addition & 0 deletions bindings/java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ services-mysql = ["opendal/services-mysql"]
services-mongodb = ["opendal/services-mongodb"]
services-sqlite = ["opendal/services-sqlite"]
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 @@ -58,11 +58,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 3694368

Please sign in to comment.