This is an automated email from the ASF dual-hosted git repository.

erickguan pushed a commit to branch ruby-tests
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit bf88dfd16bef5814887bb94e5b4d69e10561df6e
Author: Erick Guan <[email protected]>
AuthorDate: Thu May 28 23:36:04 2026 +0800

    Add service tests to ruby binding
---
 .../actions/test_behavior_binding_ruby/action.yaml | 50 +++++++++++++++
 .github/workflows/test_behavior_binding_ruby.yml   | 71 ++++++++++++++++++++++
 bindings/ruby/test/blocking_op_test.rb             |  4 +-
 bindings/ruby/test/capability_test.rb              |  4 +-
 bindings/ruby/test/io_test.rb                      |  2 +
 bindings/ruby/test/lister_test.rb                  |  2 +
 bindings/ruby/test/metadata_test.rb                |  4 +-
 bindings/ruby/test/operator_info_test.rb           |  6 +-
 8 files changed, 138 insertions(+), 5 deletions(-)

diff --git a/.github/actions/test_behavior_binding_ruby/action.yaml 
b/.github/actions/test_behavior_binding_ruby/action.yaml
new file mode 100644
index 000000000..2d3d60c1a
--- /dev/null
+++ b/.github/actions/test_behavior_binding_ruby/action.yaml
@@ -0,0 +1,50 @@
+# 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.
+
+name: Test Binding Ruby
+description: 'Test Core with given setup and service'
+inputs:
+  setup:
+    description: "The setup action for test"
+  service:
+    description: "The service to test"
+  feature:
+    description: "The feature to test"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Setup
+      shell: bash
+      run: |
+        mkdir -p ./dynamic_test_binding_ruby &&
+        cat <<EOF >./dynamic_test_binding_ruby/action.yml
+        runs:
+          using: composite
+          steps:
+          - name: Setup Test
+            uses: ./.github/services/${{ inputs.service }}/${{ inputs.setup }}
+          - name: Run Test Binding Ruby
+            shell: bash
+            working-directory: bindings/ruby
+            run: |
+              bundle exec rake test
+            env:
+              OPENDAL_TEST: ${{ inputs.service }}
+        EOF
+    - name: Run
+      uses: ./dynamic_test_binding_ruby
diff --git a/.github/workflows/test_behavior_binding_ruby.yml 
b/.github/workflows/test_behavior_binding_ruby.yml
new file mode 100644
index 000000000..cbe3772c3
--- /dev/null
+++ b/.github/workflows/test_behavior_binding_ruby.yml
@@ -0,0 +1,71 @@
+# 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.
+
+name: Behavior Test Binding Ruby
+
+on:
+  workflow_call:
+    inputs:
+      os:
+        required: true
+        type: string
+      cases:
+        required: true
+        type: string
+
+defaults:
+  run:
+    working-directory: bindings/ruby
+
+jobs:
+  test:
+    name: ${{ matrix.cases.service }} / ${{ matrix.cases.setup }}
+    runs-on: ${{ inputs.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        cases: ${{ fromJson(inputs.cases) }}
+    steps:
+      - uses: actions/checkout@v6
+      - name: Setup Rust toolchain
+        uses: ./.github/actions/setup
+        with:
+          need-nextest: true
+          need-protoc: true
+          need-rocksdb: true
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Setup 1Password Connect
+        shell: bash
+        run: |
+          echo "::add-mask::${{ secrets.OP_CONNECT_HOST }}"
+          echo "::add-mask::${{ secrets.OP_CONNECT_TOKEN }}"
+          echo "OP_CONNECT_HOST=${{ secrets.OP_CONNECT_HOST }}" >> 
"$GITHUB_ENV"
+          echo "OP_CONNECT_TOKEN=${{ secrets.OP_CONNECT_TOKEN }}" >> 
"$GITHUB_ENV"
+
+      - name: Setup Ruby and install dependencies
+        uses: ruby/setup-ruby@v1
+        with:
+          bundler-cache: true
+          working-directory: bindings/ruby # must repeat because GitHub 
Actions will not use defaults.run
+
+      - name: Test services
+        uses: ./.github/actions/test_behavior_binding_ruby
+        with:
+          setup: ${{ matrix.cases.setup }}
+          service: ${{ matrix.cases.service }}
+          feature: ${{ matrix.cases.feature }}
diff --git a/bindings/ruby/test/blocking_op_test.rb 
b/bindings/ruby/test/blocking_op_test.rb
index 079669241..d85238b0b 100644
--- a/bindings/ruby/test/blocking_op_test.rb
+++ b/bindings/ruby/test/blocking_op_test.rb
@@ -20,11 +20,13 @@
 require "test_helper"
 require "tmpdir"
 
+SERVICE = ENV["OPENDAL_TEST"] || "fs"
+
 class OpenDalTest < ActiveSupport::TestCase
   setup do
     @root = Dir.mktmpdir
     File.write("#{@root}/sample", "Sample data for testing")
-    @op = OpenDal::Operator.new("fs", {"root" => @root})
+    @op = OpenDal::Operator.new(SERVICE, {"root" => @root})
   end
 
   teardown do
diff --git a/bindings/ruby/test/capability_test.rb 
b/bindings/ruby/test/capability_test.rb
index 19a5ddddc..c17ba0be3 100644
--- a/bindings/ruby/test/capability_test.rb
+++ b/bindings/ruby/test/capability_test.rb
@@ -19,9 +19,11 @@
 
 require "test_helper"
 
+SERVICE = ENV["OPENDAL_TEST"] || "memory"
+
 class CapabilityTest < ActiveSupport::TestCase
   setup do
-    @op = OpenDal::Operator.new("memory", nil)
+    @op = OpenDal::Operator.new(SERVICE, nil)
   end
 
   test "has read capability" do
diff --git a/bindings/ruby/test/io_test.rb b/bindings/ruby/test/io_test.rb
index 76ed35e63..54228f873 100644
--- a/bindings/ruby/test/io_test.rb
+++ b/bindings/ruby/test/io_test.rb
@@ -20,6 +20,8 @@
 require "test_helper"
 require "tmpdir"
 
+SERVICE = ENV["OPENDAL_TEST"] || "fs"
+
 class IOTest < ActiveSupport::TestCase
   setup do
     @root = Dir.mktmpdir
diff --git a/bindings/ruby/test/lister_test.rb 
b/bindings/ruby/test/lister_test.rb
index bfeb043f5..3222ecf84 100644
--- a/bindings/ruby/test/lister_test.rb
+++ b/bindings/ruby/test/lister_test.rb
@@ -20,6 +20,8 @@
 require "test_helper"
 require "tmpdir"
 
+SERVICE = ENV["OPENDAL_TEST"] || "fs"
+
 class ListerTest < ActiveSupport::TestCase
   setup do
     @root = Dir.mktmpdir
diff --git a/bindings/ruby/test/metadata_test.rb 
b/bindings/ruby/test/metadata_test.rb
index 59a8c4c29..1cf32962f 100644
--- a/bindings/ruby/test/metadata_test.rb
+++ b/bindings/ruby/test/metadata_test.rb
@@ -19,9 +19,11 @@
 
 require "test_helper"
 
+SERVICE = ENV["OPENDAL_TEST"] || "memory"
+
 class MetadataTest < ActiveSupport::TestCase
   setup do
-    @op = OpenDal::Operator.new("memory", {})
+    @op = OpenDal::Operator.new(SERVICE, {})
     @op.write("/file", "OpenDAL Ruby is ready.")
   end
 
diff --git a/bindings/ruby/test/operator_info_test.rb 
b/bindings/ruby/test/operator_info_test.rb
index b287b4753..c19661b0b 100644
--- a/bindings/ruby/test/operator_info_test.rb
+++ b/bindings/ruby/test/operator_info_test.rb
@@ -19,15 +19,17 @@
 
 require "test_helper"
 
+SERVICE = ENV["OPENDAL_TEST"] || "memory"
+
 class OperatorInfoTest < ActiveSupport::TestCase
   setup do
-    @op = OpenDal::Operator.new("memory", {})
+    @op = OpenDal::Operator.new(SERVICE, {})
   end
 
   test "returns meta information" do
     info = @op.info
 
-    assert_equal "memory", info.scheme
+    assert_equal SERVICE, info.scheme
     assert_equal "/", info.root
     assert info.name.length > 0
     assert info.capability.stat

Reply via email to