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

Investigate issues on Ruby 3.1 Windows #3585

Closed
wants to merge 5 commits into from
Closed
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
35 changes: 0 additions & 35 deletions .drone.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/linux-test.yaml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/macos-test.yaml

This file was deleted.

30 changes: 10 additions & 20 deletions .github/workflows/windows-test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Testing on Windows
name: Ruby 3.1 on Windows

on:
push:
Expand All @@ -13,34 +13,24 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ['2.7', '2.6']
ruby-version: ['3.1']
in_tail: [true, false]
os:
- windows-latest
experimental: [false]
include:
- ruby-version: '3.0.3'
os: windows-latest
experimental: false
# On Ruby 3.0, we need to use fiddle 1.0.8 or later to retrieve correct
# error code. In addition, we have to specify the path of fiddle by RUBYLIB
# because RubyInstaller loads Ruby's bundled fiddle before initializing gem.
# See also:
# * https://github.com/ruby/fiddle/issues/72
# * https://bugs.ruby-lang.org/issues/17813
# * https://github.com/oneclick/rubyinstaller2/blob/8225034c22152d8195bc0aabc42a956c79d6c712/lib/ruby_installer/build/dll_directory.rb
ruby-lib-opt: RUBYLIB=%RUNNER_TOOL_CACHE%/Ruby/3.0.3/x64/lib/ruby/gems/3.0.0/gems/fiddle-1.1.0/lib

name: Unit testing with Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
name: in_tail ${{ matrix.in_tail }}
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Add Fiddle 1.1.0
if: ${{ matrix.ruby-version == '3.0.3' }}
run: gem install fiddle --version 1.1.0
- name: Install dependencies
run: ridk exec bundle install
- name: Run tests
run: bundle exec rake test TESTOPTS=-v ${{ matrix.ruby-lib-opt }}
- name: test in_tail
if: ${{ matrix.in_tail }}
run: bundle exec rake test TESTOPTS="-v --testcase='/(TailInputTest|IntailIOHandlerTest)/'"
- name: test without in_tail
if: ${{ !matrix.in_tail }}
run: bundle exec rake test TESTOPTS="-v --ignore-testcase='/(TailInputTest|IntailIOHandlerTest)/'"
103 changes: 0 additions & 103 deletions .gitlab-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ def handle_notify
end

def open
io = Fluent::FileWrapper.open(@path)
io = File.open(@path, File::Constants::RDWR | File::Constants::BINARY | File::Constants::SHARE_DELETE)
io.seek(@watcher.pe.read_pos + @fifo.bytesize)
@metrics.opened.inc
io
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def test_rotate_file_with_write_old_and_no_new_file(data)
end

def sub_test_rotate_file(config = nil, expect_emits: nil, expect_records: nil, timeout: nil)
file = Fluent::FileWrapper.open("#{TMP_DIR}/tail.txt", "wb")
file = File.open("#{TMP_DIR}/tail.txt", File::Constants::WRONLY | File::Constants::CREAT | File::Constants::TRUNC | File::Constants::BINARY | File::Constants::SHARE_DELETE)
file.puts "test1"
file.puts "test2"
file.flush
Expand Down
50 changes: 30 additions & 20 deletions test/plugin/test_out_forward.rb
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,12 @@ def try_write(chunk)
]

stub(d.instance.ack_handler).read_ack_from_sock(anything).never
target_input_driver.run(expect_records: 2) do
d.run do
emit_events.each do |tag, t, record|
d.feed(tag, t, record)
assert_rr do
target_input_driver.run(expect_records: 2) do
d.run do
emit_events.each do |tag, t, record|
d.feed(tag, t, record)
end
end
end
end
Expand All @@ -461,10 +463,12 @@ def try_write(chunk)
]

stub(d.instance.ack_handler).read_ack_from_sock(anything).never
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
assert_rr do
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
end
end
end
end
Expand All @@ -491,10 +495,12 @@ def try_write(chunk)
{"a" => 2}
]
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
assert_rr do
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
end
end
end
end
Expand Down Expand Up @@ -549,10 +555,12 @@ def try_write(chunk)
]
# not attempt to receive responses
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
assert_rr do
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
end
end
end
end
Expand All @@ -575,10 +583,12 @@ def try_write(chunk)
]
# not attempt to receive responses
stub(d.instance.ack_handler).read_ack_from_sock(anything).never
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
assert_rr do
target_input_driver.run(expect_records: 2) do
d.run(default_tag: 'test') do
records.each do |record|
d.feed(time, record)
end
end
end
end
Expand Down