Bug #16669
closedRails Action Text unit tests fail since b9007b6c548f91e88fd3f2ffa23de740431fa969
Description
This issue has been reported at Rails repository https://github.com/rails/rails/issues/38613
It always reproduces since https://github.com/ruby/ruby/commit/b9007b6c548f91e88fd3f2ffa23de740431fa969
but I do not know how to create minimum test cases without Rails repository yet.
- Steps to reproduce
- Install
ruby 2.8.0dev
b9007b6c54 or newer- Install required OS packages to run Rails refer https://guides.rubyonrails.org/development_dependencies_install.html#install-additional-tools-and-services
- git clone https://github.com/rails/rails.git
- cd rails/actiontext
- bundle install
- bin/test "test/template/form_helper_test.rb" "test/unit/model_test.rb" -n "/^(?:ActionText::ModelTest#(?:test_embed_extraction|test_embed_extraction_only_extracts_file_attachments))$/"
-
Expected result:
All of tests should pass as they pass with f2286925f08406bc857f7b03ad6779a5d61443ae or older version ofruby 2.8.0dev
, Ruby 2.7.0 or older versions of Ruby. -
Actial behavior:
These tests always fail as below.
% cd rails/actiontext
% bin/test "test/template/form_helper_test.rb" "test/unit/model_test.rb" -n "/^(?:ActionText::ModelTest#(?:test_embed_extraction|test_embed_extraction_only_extracts_file_attachments))$/"
/Users/yahonda/.rbenv/versions/2.8.0-dev/lib/ruby/gems/2.8.0/gems/tzinfo-1.2.6/lib/tzinfo/ruby_core_support.rb:163: warning: Object#taint is deprecated and will be removed in Ruby 3.2
/Users/yahonda/.rbenv/versions/2.8.0-dev/lib/ruby/gems/2.8.0/gems/tzinfo-1.2.6/lib/tzinfo/ruby_core_support.rb:163: warning: Object#tainted? is deprecated and will be removed in Ruby 3.2
/Users/yahonda/.rbenv/versions/2.8.0-dev/lib/ruby/gems/2.8.0/gems/tzinfo-1.2.6/lib/tzinfo/ruby_core_support.rb:163: warning: Object#taint is deprecated and will be removed in Ruby 3.2
/Users/yahonda/.rbenv/versions/2.8.0-dev/lib/ruby/gems/2.8.0/gems/tzinfo-1.2.6/lib/tzinfo/ruby_core_support.rb:163: warning: Object#tainted? is deprecated and will be removed in Ruby 3.2
Run options: -n "/^(?:ActionText::ModelTest#(?:test_embed_extraction|test_embed_extraction_only_extracts_file_attachments))$/" --seed 25661
# Running:
E
Error:
ActionText::ModelTest#test_embed_extraction_only_extracts_file_attachments:
NoMethodError: undefined method `runnables' for ActiveJob::Base:Class
bin/test /Users/yahonda/Desktop/rails/actiontext/test/unit/model_test.rb:38
E
Error:
ActionText::ModelTest#test_embed_extraction:
NoMethodError: undefined method `runnables' for ActiveStorage::BaseJob:Class
bin/test /Users/yahonda/Desktop/rails/actiontext/test/unit/model_test.rb:32
Finished in 0.191237s, 10.4582 runs/s, 0.0000 assertions/s.
2 runs, 0 assertions, 0 failures, 2 errors, 0 skips
%
Updated by kamipo (Ryuta Kamizono) almost 5 years ago
Action Text has much dependencies, and the failure is hard to understand which line is the cause of failure since that result show no stacktrace.
Action View failure is more ease to understand which line is the cause of failure.
https://buildkite.com/rails/rails/builds/67326#4ca28f29-d78c-4461-b1a4-367191a1cb7d/942-952
https://github.com/rails/rails/blob/6d0895a4894724e1a923a514daad8fb3c9ac2c28/actionview/lib/action_view/template.rb#L194
Updated by yahonda (Yasuo Honda) almost 5 years ago
Thanks for the information. I was aware it reproduces with Action View also but unable to create some smaller steps to reproduce. Let me try to provide some smaller test cases with Action View.
Updated by mame (Yusuke Endoh) almost 5 years ago
- Status changed from Open to Assigned
- Assignee set to ko1 (Koichi Sasada)
Great report.
Updated by ko1 (Koichi Sasada) almost 5 years ago
- Status changed from Assigned to Closed
Applied in changeset git|2943ff9d4441485a18773aa745bab7f47767dde2.
fix bug on method cache invalidation.
To invalidate cached method entry, existing method entry (ment)
is marked as invalidated and replace with copied ment. However,
complemented method entry (method entries in Module) should not
be set to Module's m_tbl.
[Bug #16669]
Updated by kamipo (Ryuta Kamizono) over 4 years ago
https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/2943ff9d4441485a18773aa745bab7f47767dde2 fixes some of failures in Rails CI, but "undefined method `root' for Rails:Module" still exist I explained above.
https://buildkite.com/rails/rails/builds/68064#d28cc26f-cdc1-4eb7-8795-41c9a2dc6f04/6-31
https://github.com/rails/rails/blob/834f5414c3b879a3a50c5cac128c9d9b007fa569/actionview/lib/action_view/template.rb#L194
Updated by k0kubun (Takashi Kokubun) over 4 years ago
- Status changed from Closed to Assigned
Updated by yahonda (Yasuo Honda) over 4 years ago
Thanks for providing a fix, which addresses the failure originally reported at Rails Action Text. https://github.com/rails/rails/issues/38613
Unfortunately, As kamipo suggested there are "undefined method `root' for Rails:Module" at Rails Action View module.
Updated by ko1 (Koichi Sasada) over 4 years ago
- Status changed from Assigned to Closed
Applied in changeset git|8119bcbfc04772fe4012b5ed396a68f02e312316.
rb_method_entry() returns valid me.
search_method() can return invalid method, but vm_defined() checks
it as valid method entry. This is why defined?(foo) if foo is undef'ed.
To solve this problem, check invalidation and return NULL.
[Bug #16669]
https://twitter.com/kamipo/status/1252881930103558144
Tests will be merged by nobu soon.
Updated by yahonda (Yasuo Honda) over 4 years ago
I have confirmed ruby 2.8.0dev (2020-04-22T17:21:38Z master 8119bcbfc0) [x86_64-darwin19]
addresses Rails Action View unit test failures/errors. Thank you.