Project

General

Profile

Bug #16669

Rails Action Text unit tests fail since b9007b6c548f91e88fd3f2ffa23de740431fa969

Added by yahonda (Yasuo Honda) 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 2.8.0dev (2020-02-22T00:58:59Z master b9007b6c54) [x86_64-darwin19]
[ruby-core:97334]

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
  1. Install ruby 2.8.0dev b9007b6c54 or newer
  2. Install required OS packages to run Rails refer https://guides.rubyonrails.org/development_dependencies_install.html#install-additional-tools-and-services
  3. git clone https://github.com/rails/rails.git
  4. cd rails/actiontext
  5. bundle install
  6. 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 of ruby 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) 3 months 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) 3 months 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) 3 months ago

  • Assignee set to ko1 (Koichi Sasada)
  • Status changed from Open to Assigned

Great report.

#4

Updated by ko1 (Koichi Sasada) 3 months 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]

#6

Updated by k0kubun (Takashi Kokubun) about 2 months ago

  • Status changed from Closed to Assigned

Updated by yahonda (Yasuo Honda) about 2 months 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.

#8

Updated by ko1 (Koichi Sasada) about 1 month 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) about 1 month 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.

Also available in: Atom PDF