Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 31 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,21 @@ jobs:
- name: Run make check for test/rb
run: make -C test/rb check

- name: Run make precross for ruby test
run: make -C test/rb precross

- name: Upload ruby precross artifacts
# has to match the version used in cross-test
if: matrix.ruby-version == '2.7' && matrix.skip-build-ext == false
uses: actions/upload-artifact@v5
with:
name: rb-precross
if-no-files-found: error
path: |
test/rb/gen-rb/*
lib/rb/ext/*.so
retention-days: 3

cross-test:
needs:
- lib-java-kotlin
Expand All @@ -705,14 +720,15 @@ jobs:
- lib-go
- lib-python
- lib-cpp
- lib-ruby
runs-on: ubuntu-24.04
strategy:
matrix:
# swift is currently broken and no maintainers around -> see THRIFT-5864
# kotlin cross test are failing -> see THRIFT-5879
server_lang: ['java', 'go', 'rs', 'cpp']
server_lang: ['java', 'go', 'rs', 'cpp', 'rb']
# we always use comma join as many client langs as possible, to reduce the number of jobs
client_lang: ['java,kotlin', 'go,rs,cpp']
client_lang: ['java,kotlin', 'go,rs,cpp,rb']
fail-fast: false
steps:
- uses: actions/checkout@v6
Expand All @@ -728,6 +744,12 @@ jobs:
java-version: 8
cache: "gradle"

- uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true
working-directory: test/rb

- name: Install openssl and certificates (for SSL tests)
run: |
sudo apt-get update -yq
Expand Down Expand Up @@ -774,6 +796,12 @@ jobs:
name: cpp-precross
path: .

- name: Download ruby precross artifacts
uses: actions/download-artifact@v6
with:
name: rb-precross
path: .

- name: Set back executable flags
run: |
chmod a+x lib/java/build/run*
Expand All @@ -785,6 +813,7 @@ jobs:
chmod a+x test/cpp/*
chmod a+x test/cpp/.libs/*
chmod a+x lib/cpp/.libs/*.so
chmod a+x lib/rb/ext/*.so

- name: Create tmp domain socket folder
run: mkdir /tmp/v0.16
Expand Down
29 changes: 29 additions & 0 deletions test/rb/core/test_accelerated_binary_protocol.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# 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.
#

require File.join(File.dirname(__FILE__), '../test_helper')

require 'thrift'

class TestThriftTransport < Test::Unit::TestCase
def test_accelerated_protocol
return if ENV['SKIP_BUILD_EXT'] == '1'
assert defined?(Thrift::BinaryProtocolAccelerated)
end
end
5 changes: 3 additions & 2 deletions test/rb/core/transport/test_transport.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
require File.join(File.dirname(__FILE__), '../../test_helper')

require 'thrift'
require 'stringio'

class DummyTransport < Thrift::BaseTransport
def initialize(data)
@data = data
@data = StringIO.new(data)
end

def read(size)
@data.slice!(0, size)
@data.read(size)
end
end

Expand Down
9 changes: 4 additions & 5 deletions test/rb/integration/TestServer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def testOneway(arg0)
elsif a.start_with?("--transport")
transport = a.split("=")[1]
elsif a.start_with?("--port")
port = a.split("=")[1].to_i
port = a.split("=")[1].to_i
end
end

Expand Down Expand Up @@ -166,12 +166,11 @@ def testOneway(arg0)
keysDir = File.join(File.dirname(File.dirname(Dir.pwd)), "keys")
ctx = OpenSSL::SSL::SSLContext.new
ctx.ca_file = File.join(keysDir, "CA.pem")
ctx.cert = OpenSSL::X509::Certificate.new(File.open(File.join(keysDir, "server.crt")))
ctx.cert = OpenSSL::X509::Certificate.new(File.binread(File.join(keysDir, "server.crt")))
ctx.cert_store = OpenSSL::X509::Store.new
ctx.cert_store.add_file(File.join(keysDir, 'client.pem'))
ctx.key = OpenSSL::PKey::RSA.new(File.open(File.join(keysDir, "server.key")))
ctx.options = OpenSSL::SSL::OP_NO_SSLv2 | OpenSSL::SSL::OP_NO_SSLv3
ctx.ssl_version = :SSLv23
ctx.key = OpenSSL::PKey::RSA.new(File.binread(File.join(keysDir, "server.key")))
ctx.min_version = :TLS1_2
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
@transport = Thrift::SSLServerSocket.new(nil, port, ctx)
else
Expand Down