diff --git a/test/command/test_fluentd.rb b/test/command/test_fluentd.rb index 87c9d28d96..c6bd88d857 100644 --- a/test/command/test_fluentd.rb +++ b/test/command/test_fluentd.rb @@ -941,7 +941,7 @@ def multi_workers_ready? '-external-encoding' => '--external-encoding=utf-8', '-internal-encoding' => '--internal-encoding=utf-8', ) - test "-E option is set to RUBYOPT" do |opt| + test "-E option is set to RUBYOPT" do |base_opt| conf = < @type dummy @@ -952,6 +952,7 @@ def multi_workers_ready? CONF conf_path = create_conf_file('rubyopt_test.conf', conf) + opt = base_opt.dup opt << " #{ENV['RUBYOPT']}" if ENV['RUBYOPT'] assert_log_matches( create_cmdline(conf_path), @@ -991,9 +992,14 @@ def multi_workers_ready? CONF conf_path = create_conf_file('rubyopt_invalid_test.conf', conf) + if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('3.3.0') + expected_phrase = 'ruby: invalid switch in RUBYOPT' + else + expected_phrase = 'Invalid option is passed to RUBYOPT' + end assert_log_matches( create_cmdline(conf_path), - 'Invalid option is passed to RUBYOPT', + expected_phrase, env: { 'RUBYOPT' => 'a' }, ) end