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

Suppress warning for 2.7 #2753

Merged
merged 5 commits into from Jan 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fluent/command/plugin_generator.rb
Expand Up @@ -281,7 +281,7 @@ def initialize
@text = ""
@preamble_source = ""
@preamble = nil
open(LICENSE_URL) do |io|
URI.open(LICENSE_URL) do |io|
@text = io.read
end
@preamble_source = @text[/^(\s*Copyright.+)/m, 1]
Expand Down
6 changes: 6 additions & 0 deletions lib/fluent/plugin/parser.rb
Expand Up @@ -105,6 +105,12 @@ def parser_type
:text_per_line
end

def initialize
super

@timeout_checker = nil
end

def configure(conf)
super

Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/supervisor.rb
Expand Up @@ -794,7 +794,7 @@ def build_system_config(conf)
opt[param] = @cl_opt[param]
end
end
system_config.overwrite_variables(opt)
system_config.overwrite_variables(**opt)
system_config
end
end
Expand Down
7 changes: 4 additions & 3 deletions lib/fluent/test/driver/base.rb
Expand Up @@ -22,6 +22,7 @@
require 'serverengine/socket_manager'
require 'fileutils'
require 'timeout'
require 'logger'

module Fluent
module Test
Expand Down Expand Up @@ -135,16 +136,16 @@ def instance_hook_before_stopped
# same with above
end

def instance_shutdown
def instance_shutdown(log: Logger.new($stdout))
instance_hook_before_stopped

show_errors_if_exists = ->(label, block){
begin
block.call
rescue => e
puts "unexpected error while #{label}, #{e.class}:#{e.message}"
log.error "unexpected error while #{label}, #{e.class}:#{e.message}"
e.backtrace.each do |bt|
puts "\t#{bt}"
log.error "\t#{bt}"
end
end
}
Expand Down
8 changes: 4 additions & 4 deletions test/config/test_system_config.rb
Expand Up @@ -68,7 +68,7 @@ def parse_text(text)
EOS
s = FakeSupervisor.new
sc = Fluent::SystemConfig.new(conf)
sc.overwrite_variables(s.for_system_config)
sc.overwrite_variables(**s.for_system_config)
assert_equal(1, sc.workers)
assert_nil(sc.root_dir)
assert_equal(Fluent::Log::LEVEL_INFO, sc.log_level)
Expand Down Expand Up @@ -98,7 +98,7 @@ def parse_text(text)
EOS
s = FakeSupervisor.new
sc = Fluent::SystemConfig.new(conf)
sc.overwrite_variables(s.for_system_config)
sc.overwrite_variables(**s.for_system_config)
if k == 'log_level'
assert_equal(Fluent::Log::LEVEL_ERROR, sc.__send__(k))
else
Expand All @@ -117,7 +117,7 @@ def parse_text(text)
EOS
s = FakeSupervisor.new
sc = Fluent::SystemConfig.new(conf)
sc.overwrite_variables(s.for_system_config)
sc.overwrite_variables(**s.for_system_config)
assert_equal(:json, sc.log.format)
assert_equal('%Y', sc.log.time_format)
end
Expand All @@ -136,7 +136,7 @@ def parse_text(text)
EOS
s = FakeSupervisor.new(log_level: level)
sc = Fluent::SystemConfig.new(conf)
sc.overwrite_variables(s.for_system_config)
sc.overwrite_variables(**s.for_system_config)
assert_equal(level, sc.log_level)
end
end
Expand Down
10 changes: 8 additions & 2 deletions test/plugin/test_out_http.rb
Expand Up @@ -117,7 +117,7 @@ def run_http_server
Fluent::Test.setup
FileUtils.rm_rf(TMP_DIR)

@@result = Result.new(nil, nil, {}, nil)
@@result = Result.new(nil, nil, {}, nil)
@@http_server_thread ||= Thread.new do
run_http_server
end
Expand Down Expand Up @@ -230,6 +230,9 @@ def test_write_with_headers
end

def test_write_with_retryable_response
old_report_on_exception = Thread.report_on_exception
Thread.report_on_exception = false # thread finished as invalid state since RetryableResponse raises.

d = create_driver("endpoint #{base_endpoint}/503")
assert_raise(Fluent::Plugin::HTTPOutput::RetryableResponse) do
d.run(default_tag: 'test.http', shutdown: false) do
Expand All @@ -238,7 +241,10 @@ def test_write_with_retryable_response
}
end
end
d.instance_shutdown

d.instance_shutdown(log: $log)
ensure
Thread.report_on_exception = old_report_on_exception
end

def test_write_with_disabled_unrecoverable
Expand Down
2 changes: 2 additions & 0 deletions test/test_supervisor.rb
Expand Up @@ -409,6 +409,8 @@ def test_logger_with_rotate_age_and_rotate_size(rotate_age)
end

def test_inline_config
omit 'this feature is deprecated. see https://github.com/fluent/fluentd/issues/2711'

opts = Fluent::Supervisor.default_options
opts[:inline_config] = '-'
sv = Fluent::Supervisor.new(opts)
Expand Down