@@ -50,13 +50,11 @@ def create_cmdline(conf_path, *fluentd_options)
50
50
[ "bundle" , "exec" , "ruby" , cmd_path , "-c" , conf_path , *fluentd_options ]
51
51
end
52
52
53
- def execute_command ( cmdline , chdir = TMP_DIR )
53
+ def execute_command ( cmdline , chdir = TMP_DIR , env = { } )
54
54
null_stream = File . open ( File ::NULL , 'w' )
55
55
gemfile_path = File . expand_path ( File . dirname ( __FILE__ ) + "../../../Gemfile" )
56
56
57
- env = {
58
- "BUNDLE_GEMFILE" => gemfile_path ,
59
- }
57
+ env = { "BUNDLE_GEMFILE" => gemfile_path } . merge ( env )
60
58
cmdname = cmdline . shift
61
59
arg0 = "testing-fluentd"
62
60
# p(here: "executing process", env: env, cmdname: cmdname, arg0: arg0, args: cmdline)
@@ -81,12 +79,12 @@ def execute_command(cmdline, chdir=TMP_DIR)
81
79
null_stream . close rescue nil
82
80
end
83
81
84
- def assert_log_matches ( cmdline , *pattern_list , patterns_not_match : [ ] , timeout : 10 )
82
+ def assert_log_matches ( cmdline , *pattern_list , patterns_not_match : [ ] , timeout : 10 , env : { } )
85
83
matched = false
86
84
assert_error_msg = "matched correctly"
87
85
stdio_buf = ""
88
86
begin
89
- execute_command ( cmdline ) do |pid , stdout |
87
+ execute_command ( cmdline , TMP_DIR , env ) do |pid , stdout |
90
88
begin
91
89
waiting ( timeout ) do
92
90
while process_exist? ( pid ) && !matched
@@ -780,6 +778,25 @@ def multi_workers_ready?
780
778
)
781
779
end
782
780
781
+ test "multiple values are set to RUBYOPT" do
782
+ conf = <<CONF
783
+ <source>
784
+ @type dummy
785
+ tag dummy
786
+ </source>
787
+ <match>
788
+ @type null
789
+ </match>
790
+ CONF
791
+ conf_path = create_conf_file ( 'rubyopt_test.conf' , conf )
792
+ assert_log_matches (
793
+ create_cmdline ( conf_path ) ,
794
+ '#0 fluentd worker is now running worker=0' ,
795
+ patterns_not_match : [ '(LoadError)' ] ,
796
+ env : { 'RUBYOPT' => '-rtest-unit -ruri' } ,
797
+ )
798
+ end
799
+
783
800
test 'success to start workers when file buffer is configured in non-workers way only for specific worker' do
784
801
conf = <<CONF
785
802
<system>
0 commit comments