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

test_child_process: Fix a failed test on rbenv #3410

Merged
merged 1 commit into from
Jun 4, 2021

Conversation

ashie
Copy link
Member

@ashie ashie commented Jun 4, 2021

Which issue(s) this PR fixes:
none

What this PR does / why we need it:
The test "can specify subprocess name" is failed on rbenv because the
ruby command is executed via rbenv-exec.
This commit replace the ruby command with sh,
because this test doesn't require ruby.

Failure: test: can specify subprocess name(ChildProcessTest):
          assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
                  |          |                                      |     |     |           |   |
                  |          |                                      |     |     |           |   false
                  |          |                                      |     |     |           "bash"
                  |          |                                      |     |     ["557858", "bash", "/home/aho/.rbenv/libexec/rbenv-exec", "ruby", "-e", "sleep", "10;", "puts", "\"hello\""]
                  |          |                                      |     "557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\""
                  |          |                                      " 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n"
                  |          [" 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n"]
                  ["    PID CMD\n", " 457382 /usr/libexec/gdm-wayland-session env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu\n", " 457385 /usr/libexec/gnome-session-binary --systemd --session=ubuntu\n", " 477521 bash\n", " 490520 bash\n", " 490781 bash\n", " 539652 emacs -nw test/plugin_helper/test_child_process.rb\n", " 556315 ruby -e Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end\n", " 557215 ruby2.7 /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/bin/rake test TEST=test/plugin_helper/test_child_process.rb\n", " 557246 sh -c /usr/bin/ruby2.7 -w -I\"lib:test\" -Eascii-8bit:ascii-8bit /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb \"test/plugin_helper/test_child_process.rb\" \n", " 557247 /usr/bin/ruby2.7 -w -Ilib:test -Eascii-8bit:ascii-8bit /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb test/plugin_helper/test_child_process.rb\n", " 557554 ruby -e Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end\n", " 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n", " 557859 ps opid,cmd\n"]
/home/aho/Projects/Fluentd/fluentd/test/plugin_helper/test_child_process.rb:575:in `block (2 levels) in <class:ChildProcessTest>'
     572:         m.lock
     573:         pid = pids.first
     574:         # 16357 sleeeeeeeeeper -e sleep 10; puts "hello"
  => 575:         assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
     576:         @d.stop; @d.shutdown; @d.close; @d.terminate
     577:       end
     578:     end
/usr/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
/usr/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
/home/aho/Projects/Fluentd/fluentd/test/plugin_helper/test_child_process.rb:561:in `block in <class:ChildProcessTest>'

Docs Changes:
none

Release Note:
none

The test "can specify subprocess name" is failed on rbenv because the
ruby command is executed via rbenv-exec.
This commit replace the ruby command with sh.

```
Failure: test: can specify subprocess name(ChildProcessTest):
          assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
                  |          |                                      |     |     |           |   |
                  |          |                                      |     |     |           |   false
                  |          |                                      |     |     |           "bash"
                  |          |                                      |     |     ["557858", "bash", "/home/aho/.rbenv/libexec/rbenv-exec", "ruby", "-e", "sleep", "10;", "puts", "\"hello\""]
                  |          |                                      |     "557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\""
                  |          |                                      " 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n"
                  |          [" 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n"]
                  ["    PID CMD\n", " 457382 /usr/libexec/gdm-wayland-session env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --session=ubuntu\n", " 457385 /usr/libexec/gnome-session-binary --systemd --session=ubuntu\n", " 477521 bash\n", " 490520 bash\n", " 490781 bash\n", " 539652 emacs -nw test/plugin_helper/test_child_process.rb\n", " 556315 ruby -e Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end\n", " 557215 ruby2.7 /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/bin/rake test TEST=test/plugin_helper/test_child_process.rb\n", " 557246 sh -c /usr/bin/ruby2.7 -w -I\"lib:test\" -Eascii-8bit:ascii-8bit /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb \"test/plugin_helper/test_child_process.rb\" \n", " 557247 /usr/bin/ruby2.7 -w -Ilib:test -Eascii-8bit:ascii-8bit /home/aho/Projects/Fluentd/fluentd/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/lib/rake/rake_test_loader.rb test/plugin_helper/test_child_process.rb\n", " 557554 ruby -e Signal.trap(:TERM, nil); while sleep 0.1; puts 1; STDOUT.flush rescue nil; end\n", " 557858 bash /home/aho/.rbenv/libexec/rbenv-exec ruby -e sleep 10; puts \"hello\"\n", " 557859 ps opid,cmd\n"]
/home/aho/Projects/Fluentd/fluentd/test/plugin_helper/test_child_process.rb:575:in `block (2 levels) in <class:ChildProcessTest>'
     572:         m.lock
     573:         pid = pids.first
     574:         # 16357 sleeeeeeeeeper -e sleep 10; puts "hello"
  => 575:         assert{ proc_lines.select{|line| line =~ /^\s*#{pid}\s/ }.first.strip.split(/\s+/)[1] == "sleeeeeeeeeper" }
     576:         @d.stop; @d.shutdown; @d.close; @d.terminate
     577:       end
     578:     end
/usr/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `block in catch'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
/usr/lib/ruby/2.7.0/timeout.rb:33:in `catch'
/usr/lib/ruby/2.7.0/timeout.rb:110:in `timeout'
/home/aho/Projects/Fluentd/fluentd/test/plugin_helper/test_child_process.rb:561:in `block in <class:ChildProcessTest>'
```

Signed-off-by: Takuro Ashie <[email protected]>
@ashie ashie requested a review from cosmo0920 June 4, 2021 05:47
Copy link
Contributor

@cosmo0920 cosmo0920 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks reasonable for me.

@ashie ashie merged commit 3f4c267 into fluent:master Jun 4, 2021
@ashie ashie deleted the fix-child-process-test-on-rbenv branch June 4, 2021 05:49
@ashie
Copy link
Member Author

ashie commented Jun 4, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants